Global

Methods

click(btn)object

Returns an object with pointing_button property, which can be passed to Rule#remap as from or to properties.

Parameters:
Name Type Description
btn string

button name

  • button1
  • button2
  • button3
  • left (alias for button1)
  • right (alias for button2)
  • middle (alias for button3)
Source:
fn.js, line 82
Returns:

an object like: { pointing_button: ... }

Type:
object

if_app(…idrpt)object

Returns an object with type: 'frontmost_application_if' property, which can be passed to Rule#cond as a condition.

Parameters:
Name Type Description
idrpt string

application id

Source:
fn.js, line 143
Returns:

an object like: { type: 'frontmost_application_if', ... }

Type:
object

if_lang(…langrpt)object

Returns an object with type: 'input_source_if' property, which can be passed to Rule#cond as a condition.

Parameters:
Name Type Description
langrpt string

language code

Source:
fn.js, line 167
Returns:

an object like: { type: 'input_source_if', ... }

Type:
object

if_var(name, value)object

Returns an object with type: 'variable_if' property, which can be passed to Rule#cond as a condition.

Parameters:
Name Type Description
name string

variable name

value
  • string
  • number

value to check

Source:
fn.js, line 116
Returns:

an object like: { type: 'variable_if', ... }

Type:
object

key(code, mods, optsopt)object

Returns an object with key_code property,
which can be passed to Rule#remap as from or to properties.

Parameters:
Name Type Description
code
  • string
  • string[]
  • array[]

key code(s)

mods
  • string
  • object
  • string[]

modifiers

optsopt object

optional properties

Source:
fn.js, line 11
Returns:

an object like: { key_code: ... }

Type:
object

set_var(name, value, optsopt)object

Returns an object with set_variable property, which can be passed to Rule#remap as to property.

Parameters:
Name Type Description
name string

variable name

value
  • string
  • number

value to assign

optsopt object

optional properties

Source:
fn.js, line 100
Returns:

an object like: { set_variable: { ... } }

Type:
object

unless_app(…idrpt)object

Returns an object with type: 'frontmost_application_unless' property, which can be passed to Rule#cond as a condition.

Parameters:
Name Type Description
idrpt string

application id

Source:
fn.js, line 155
Returns:

an object like: { type: 'frontmost_application_unless', ... }

Type:
object

unless_lang(…langrpt)object

Returns an object with type: 'input_source_unless' property, which can be passed to Rule#cond as a condition.

Parameters:
Name Type Description
langrpt string

language code

Source:
fn.js, line 181
Returns:

an object like: { type: 'input_source_unless', ... }

Type:
object

unless_var(name, value)object

Returns an object with type: 'variable_unless' property, which can be passed to Rule#cond as a condition.

Parameters:
Name Type Description
name string

variable name

value
  • string
  • number

value to check

Source:
fn.js, line 130
Returns:

an object like: { type: 'variable_unless', ... }

Type:
object

Type Definitions

Keymap

A keymap definition which can be passed to Rule#remap as from or to properties.
It can be an object like { key_code: 'a', ... }, or a string in the special format.

Object Format

A plain object that loosely follows the Karabiner's specifications.
key function returns in this format.

String Format

A special expression that is only supported by Karabinerge for user's convenience.
Here are some examples:

Expression Meaning
'a' a key
'shift + a' a key with shift modifier
'shift + control + a' a key with shift + control modifiers
'shift + (control) + a' a key with shift + optional control modifiers
Source:
Rule.js, line 5
Type:
  • object
  • string