« Karabiner/Manipulator/Conditions/Device_if.pm
↑ Summary
Karabiner/Manipulator/Actions/To_after_key_up.pm »
| 1 | package JSON::Karabiner::Manipulator::Actions ; | ||||||||||
| 2 | 13 | $JSON::Karabiner::Manipulator::Actions::VERSION = '0.018'; | |||||||||
| 3 | 13 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 13 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 13 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 13 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 29 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 9 | 29 | my $class = shift; | |||||||||
| 10 | 29 | my $type = shift; | |||||||||
| 11 | |||||||||||
| 12 | 29 | my $self = { | |||||||||
| 13 | def_name => $type, | ||||||||||
| 14 | consumer_key_code => 0, | ||||||||||
| 15 | pointing_button => 0, | ||||||||||
| 16 | key_code => 0, | ||||||||||
| 17 | any => 0, | ||||||||||
| 18 | last_key_code => '', | ||||||||||
| 19 | |||||||||||
| 20 | }; | ||||||||||
| 21 | 29 | bless $self, $class; | |||||||||
| 22 | { | ||||||||||
| 23 | 13 | ▶ | no warnings 'once'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 29 | $main::current_action = $self; | |||||||||
| 25 | } | ||||||||||
| 26 | 29 | return $self; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 9 | ▶ | sub add_consumer_key_code { | ||||||||
|
Subroutine
add_consumer_key_code: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 30 | 9 | my $s = shift; | |||||||||
| 31 | 9 | ▶ | croak 'You must pass a value' if !$_[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 8 | $s->add_key_code(@_, 'consumer_key_code'); | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 7 | ▶ | sub add_pointing_button { | ||||||||
|
Subroutine
add_pointing_button: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 36 | 7 | my $s = shift; | |||||||||
| 37 | 7 | ▶ | croak 'You must pass a value' if !$_[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 7 | $s->add_key_code(@_, 'pointing_button'); | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 103 | ▶ | sub _is_exclusive { | ||||||||
|
Subroutine
_is_exclusive: called CC=2 SCAR=7.0
| |||||||||||
| 42 | 103 | my $s = shift; | |||||||||
| 43 | 103 | my $property = shift; | |||||||||
| 44 | 103 | ▶ | croak 'No property passed' unless $property; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | # my $is_exclusive = !grep { !$s->{$_} unless $_ eq $property } qw(shell_command select_input_source set_variable mouse_key consumer_key_code pointing_button key_code); | ||||||||||
| 46 | # croak 'Property already set that conflicts with the propert you are trying to set' unless $is_exclusive; | ||||||||||
| 47 | 103 | $s->{$property} = 1; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | |||||||||||
| 51 | # ABSTRACT: parent class for action classes | ||||||||||
| 52 | |||||||||||
| 53 | 13 | 1; | |||||||||
| 54 | |||||||||||
| 55 | __END__ | ||||||||||