| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package JSON::Karabiner::Manipulator::Actions ; |
|
2
|
|
|
|
|
|
|
$JSON::Karabiner::Manipulator::Actions::VERSION = '0.016'; |
|
3
|
12
|
|
|
12
|
|
6451
|
use strict; |
|
|
12
|
|
|
|
|
29
|
|
|
|
12
|
|
|
|
|
354
|
|
|
4
|
12
|
|
|
12
|
|
60
|
use warnings; |
|
|
12
|
|
|
|
|
28
|
|
|
|
12
|
|
|
|
|
320
|
|
|
5
|
12
|
|
|
12
|
|
57
|
use JSON; |
|
|
12
|
|
|
|
|
29
|
|
|
|
12
|
|
|
|
|
61
|
|
|
6
|
12
|
|
|
12
|
|
1177
|
use Carp; |
|
|
12
|
|
|
|
|
260
|
|
|
|
12
|
|
|
|
|
1290
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
|
9
|
28
|
|
|
28
|
1
|
55
|
my $class = shift; |
|
10
|
28
|
|
|
|
|
46
|
my $type = shift; |
|
11
|
|
|
|
|
|
|
|
|
12
|
28
|
|
|
|
|
163
|
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
|
28
|
|
|
|
|
86
|
bless $self, $class; |
|
22
|
|
|
|
|
|
|
{ |
|
23
|
12
|
|
|
12
|
|
129
|
no warnings 'once'; |
|
|
12
|
|
|
|
|
28
|
|
|
|
12
|
|
|
|
|
3432
|
|
|
|
28
|
|
|
|
|
46
|
|
|
24
|
28
|
|
|
|
|
73
|
$main::current_action = $self; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
28
|
|
|
|
|
72
|
return $self; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub add_consumer_key_code { |
|
30
|
9
|
|
|
9
|
1
|
3363
|
my $s = shift; |
|
31
|
9
|
100
|
|
|
|
49
|
croak 'You must pass a value' if !$_[0]; |
|
32
|
8
|
|
|
|
|
34
|
$s->add_key_code(@_, 'consumer_key_code'); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub add_pointing_button { |
|
36
|
7
|
|
|
7
|
1
|
2762
|
my $s = shift; |
|
37
|
7
|
50
|
|
|
|
29
|
croak 'You must pass a value' if !$_[0]; |
|
38
|
7
|
|
|
|
|
25
|
$s->add_key_code(@_, 'pointing_button'); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _is_exclusive { |
|
42
|
102
|
|
|
102
|
|
190
|
my $s = shift; |
|
43
|
102
|
|
|
|
|
158
|
my $property = shift; |
|
44
|
102
|
50
|
|
|
|
229
|
croak 'No property passed' unless $property; |
|
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
|
102
|
|
|
|
|
246
|
$s->{$property} = 1; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub TO_JSON { |
|
51
|
0
|
|
|
0
|
1
|
|
my $obj = shift; |
|
52
|
0
|
|
|
|
|
|
my $name = $obj->{def_name}; |
|
53
|
0
|
|
|
|
|
|
my $value = $obj->{data}; |
|
54
|
0
|
|
|
|
|
|
return { $name => $value }; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# return { %{ shift() } }; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# ABSTRACT: parent class for action classes |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |