hammerspoon2-docs
    Preparing search index...

    Namespace menubar

    Module for creating and managing macOS system menu bar items. Menu bar items appear in the right side of the macOS menu bar (alongside the clock, Wi-Fi icon, etc.). Each item can display a title, an icon, or both, and can open a menu or invoke a callback when clicked.

    const item = hs.menubar.create()
    item.title = "Hello"
    item.setClickCallback(() => console.log("clicked!"))
    const item = hs.menubar.create()
    item.setIcon(HSImage.fromSymbol("star.fill"))
    item.setTooltip("My automation")
    item.setMenu([
    { title: "Reload config", fn: () => hs.reload() },
    { title: "-" },
    { title: "Remove from menubar", fn: () => item.hide() }
    ])
    const item = hs.menubar.create()
    item.title = "Dynamic"
    item.setMenu(() => [
    { title: "Time: " + new Date().toLocaleTimeString() },
    { title: "-" },
    { title: "Remove from menubar", fn: () => item.hide() }
    ])

    Functions

    create