NAME

JSON::Karabiner::Manipulator::Conditions - turns baubles into trinkets

SYNOPSIS

use JSON::Karabiner;

# first, create the condition object
my $variable_cond_obj = $manip_obj->add_condition('variable_if');

# next, add data to it
$variable_cond_obj->add_variable('some_var_name' => 'some_value')

DESCRIPTION

Condtions make the from and to actions conditional upon the values of other data. This gives you more control over when and under what environments your actions will occur. Below is an overview of how to set the conditions available to you via Karabiner.

Note that the condition objects must be created before you can add data to them. See the example in the Synopsis above.

'device_if' and 'device_unless'

$device_condition_obj->add_identifier('vendor_id' => 5, 'product_id' => 2222);
$device_condition_obj->add_identifier('vendor_id' => 6, 'product_id' => 2223);
$device_condition_obj->add_description('some description');

See Karabiner official documentation

'event_changed_if' and 'event_chaned_unless'

$event_condition_obj->add_value( 'true' );
$event_condition_obj->add_description('some description');

See Karabiner official documentation

'frontmost_application_if' and 'frontmost_application_unless'

$fm_app_obj->add_bundle_identifiers( 'bundle_id_one', 'bundle_id_two');
$fm_app_obj->add_file_paths( 'file_path1', 'file_path2');
$fm_app_obj->add_description('some description');

See Karabiner official documentation

'input_source_if', and 'input_source_unless'

$input_source_obj->add_input_source('language' => 'languare regex', 'input_source_id' => 'input source id regex');
$input_source_obj->add_input_source('language' => 'languare regex', 'input_source_id' => 'input source id regex');
$input_source_obj->add_description('some description');

See Karabiner official documentation

'keyboard_type_if', and 'keyboard_type_unless'

$keybd_condition_obj->add_keyboard_types('keybd_type1', 'keybd_type2')
$keybd_condition_obj->add_description('some description')

See Karabiner official documentation

'variable_if', and 'variable_unless'

$var_cond_obj->add_variable('variable_name' => 'value');

See Karabiner official documentation

VERSION

version 0.006

AUTHOR

Steve Dondley <s@dondley.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by Steve Dondley.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.