hammerspoon2-docs
    Preparing search index...

    Class HSEventTapHotkey

    A keyboard shortcut binding backed by an event tap. Supports fn modifier and left/right modifier key distinction. Obtain instances via hs.eventtap.bindHotkey() — do not instantiate directly.

    Index

    Constructors

    Properties

    key: string | number

    The key this hotkey was bound with, as originally passed to bindHotkey()

    keyCode: number

    The virtual key code this hotkey currently matches. For a hotkey bound by key name this follows the keyboard layout (see hs.eventtap.followsKeyboardLayout).

    onPressed: (() => void) | null

    The callback function to be called when the hotkey is pressed, or null to remove it

    onReleased: (() => void) | null

    The callback function to be called when the hotkey is released, or null to remove it

    Methods

    • Disable the hotkey

      Returns void

    • Enable the hotkey

      Returns boolean

      True if the hotkey was enabled, otherwise False

      An enabled hotkey, and its callbacks, stay alive until it's disabled, even if you don't keep a reference to it

    • Check if the hotkey is currently enabled

      Returns boolean

      True if the hotkey is enabled, otherwise False