input listen for platform

Listen for user interface event.


> input listen {flags}


  • --types, -t {list<string>}: Listen for event of specified types only (can be one of: focus, key, mouse, paste, resize)
  • --raw, -r: Add raw_code field with numeric value of keycode and raw_flags with bit mask flags

Input/output types:

nothingrecord<keycode: string, modifiers: list<string>>


Listen for a keyboard shortcut and find out how nu receives it

> input listen --types [key]


There are 5 different type of events: focus, key, mouse, paste, resize. Each will produce a corresponding record, distinguished by type field:

    { type: focus event: (gained|lost) }
    { type: key key_type: <key_type> code: <string> modifiers: [ <modifier> ... ] }
    { type: mouse col: <int> row: <int> kind: <string> modifiers: [ <modifier> ... ] }
    { type: paste content: <string> }
    { type: resize col: <int> row: <int> }

There are 6 modifier variants: shift, control, alt, super, hyper, meta. There are 4 key_type variants: f - f1, f2, f3 ... keys char - alphanumeric and special symbols (a, A, 1, $ ...) media - dedicated media keys (play, pause, tracknext ...) other - keys not falling under previous categories (up, down, backspace, enter ...)