hammerspoon2-docs
    Preparing search index...

    Class HSHotkeyModal

    A modal hotkey group returned by hs.hotkey.createModal(). Hotkeys bound to the modal via bind() are only enabled while the modal is active (i.e. between enter() and exit()).

    Index
    isActive: boolean

    Whether the modal is currently active

    onEnter: Function | null

    Callback invoked when the modal is entered

    onExit: Function | null

    Callback invoked when the modal is exited

    • Bind a hotkey to this modal. The hotkey is only enabled while the modal is active.

      Parameters

      • mods: string[]

        Modifier keys for the hotkey (e.g. ["cmd", "shift"])

      • key: string | number

        Key name or numeric key code for the hotkey (e.g. "h")

      • onPressed: Function | null

        Called when the hotkey is pressed, or null

      • OptionalonReleased: Function | null

        Called when the hotkey is released, or null/omitted

      • OptionalonRepeat: Function | null

        Called repeatedly while the hotkey is held down, or null/omitted

      Returns HSHotkeyModal

      This modal, for chaining

    • Destroy the modal, along with its trigger and all hotkeys bound to it.

      Returns void

    • Enter the modal: its trigger (if any) is disabled and its bound hotkeys are enabled.

      Returns HSHotkeyModal

      This modal, for chaining

    • Exit the modal: its bound hotkeys are disabled and its trigger (if any) is re-enabled.

      Returns HSHotkeyModal

      This modal, for chaining