hammerspoon2-docs
    Preparing search index...

    Function setMenu

    • Set extra items for the menu shown when the Dock icon is right-clicked (or Control-clicked, or held).

      The items appear above the Dock's own items (Options, Show All Windows, Hide and Quit). Pass an array of menu item objects for a static menu, or a function that returns an array for a menu populated each time it opens. The function receives one argument: the modifier keys held when the menu opened, in the same form as hs.eventtap.currentModifiers().

      The menu items are HSMenuItem objects, the same as for HSMenuBarItem.setMenu(). Their shortcut is accepted so that the same items can be shared with HSMenuBarItem.setMenu(), but the Dock ignores it: it draws the menu itself, shows no shortcuts, and pressing one does nothing. Menu shortcuts are never system-wide hotkeys anyway; use hs.hotkey.bind() for those.

      The menu is removed when the config is reloaded.

      Parameters

      • menuOrFn: HSMenuItem[] | ((modifiers: string[]) => HSMenuItem[]) | null

        Array of menu items, a function returning such an array, or null to remove the extra items

      Returns void