A keyboard shortcut for userscript action.

interface KeyboardShortcut {
    callback: () => void;
    description: string;
    shortcutId: string;
    shortcutKeys: null | string;
}

Properties

callback: () => void

A callback to be executed when the shortcutKeys are pressed.

description: string

A human-readable description of the shortcut.

shortcutId: string

A unique id for the shortcut.

shortcutKeys: null | string

A unique combination of keys to be pressed to trigger the shortcut, or null if representing an empty shortcut. The string is expected to be in the following format: [0-3 modifiers]+[single alphanumeric char OR keycode].

Supported modifiers:

  • A - Alt
  • C - Control or Meta
  • S - Shift
"A" - press 'a' to trigger the shortcut
"C+3" - press Ctrl-3 to trigger the shortcut
"AS+32" - press Alt-Shift-Space to trigger the shortcut