| 1 | package JSON::Karabiner::Manipulator::Conditions::Frontmost_application_if ; | ||
| 2 | $JSON::Karabiner::Manipulator::Conditions::Frontmost_application_if::VERSION = '0.008'; | ||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use JSON; | ||
| 6 | use Carp; | ||
| 7 | use parent 'JSON::Karabiner::Manipulator::Conditions'; | ||
| 8 | |||
| 9 | sub new { | ||
| 10 | my $class = shift; | ||
| 11 | my ($type, $value) = @_; | ||
| 12 | my $obj = $class->SUPER::new($type, $value); | ||
| 13 | $obj->{data} = $value || [], | ||
| 14 | return $obj; | ||
| 15 | } | ||
| 16 | |||
| 17 | sub add_bundle_identifiers { | ||
| 18 | my $s = shift; | ||
| 19 | my @identifiers = @_; | ||
| 20 | croak ('No identifier regular expressions passed.') unless @identifiers; | ||
| 21 | push @{$s->{data}}, { bundle_identifiers => [ @identifiers ] }; | ||
| 22 | |||
| 23 | } | ||
| 24 | |||
| 25 | sub add_file_paths { | ||
| 26 | my $s = shift; | ||
| 27 | my @files = @_; | ||
| 28 | croak ('No file path regular expressions passed.') unless @files; | ||
| 29 | push @{$s->{data}}, { file_paths => [ @files ] }; | ||
| 30 | |||
| 31 | } | ||
| 32 | |||
| 33 | sub add_description { | ||
| 34 | my $s = shift; | ||
| 35 | my $desc = shift; | ||
| 36 | croak ('No file path regular expressions passed.') unless $desc; | ||
| 37 | push @{$s->{data}}, { description => $desc }; | ||
| 38 | |||
| 39 | } | ||
| 40 | # ABSTRACT: definition for Frontmost_application_if condition | ||
| 41 | |||
| 42 | 1; | ||
| 43 | |||
| 44 | __END__ |