Get or set the menu item's title.
Get or set the colour of the menu item's title text, or null to use the menu bar's standard text colour.
Permanently remove this item from the menu bar and release all resources.
After calling destroy(), the item is no longer usable.
This is called automatically on hs.reload(). Use hide() instead
if you only want to temporarily remove the item without freeing it.
Remove this item from the menu bar. It can be shown again with show() while you keep a reference to it.
Check if this item is currently visible in the menu bar.
true if the item is visible in the menu bar
Immediately open a menu below this item, independently of any menu set with setMenu().
This is intended to be called from a click callback, so that a single item can perform an action on one
kind of click and offer a menu on another. The menu item objects are the same as for setMenu().
If the item is hidden, the menu opens at the mouse pointer instead.
Array of menu item objects
Set a callback invoked when the item is clicked with any mouse button (only fires when no menu is set).
The callback receives two arguments:
button (string): "left", "right" or "middle", or "buttonN" for other buttons, numbered
from 1 (so a mouse's fourth and fifth buttons are "button4" and "button5"). A Ctrl-click, the
standard macOS secondary click, is reported as "right" (and modifiers still includes "ctrl").modifiers (string[]): The modifier keys held during the click, in the same form as
hs.eventtap.currentModifiers() (e.g. ["cmd", "leftCmd"]).To offer a menu alongside a click action, leave the menu unset and call popUpMenu() from this callback.
A function to call on click, or null to remove the callback
Set the icon displayed in the menu bar
An HSImage object, or null to remove the icon
Set the menu for this item. Pass an array of menu item objects for a static menu,
or a function that returns an array for a dynamic 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().
While a menu is set, clicking the item opens the menu and the click callback is not called.
Menu item object keys:
title (string, required): The item label. Use "-" for a separator line.fn (function): Callback invoked when the item is chosen.checked (boolean): If true, a checkmark is shown next to the item.disabled (boolean): If true, the item is greyed out and cannot be chosen.tooltip (string): Tooltip shown when hovering over the item.color (HSColor or hex string): The colour of the item's title text.icon (HSImage): Icon shown to the left of the title.menu (array): Nested array of menu item objects to create a submenu.Array of menu item objects, a function returning such an array, or null to remove the menu
Set the tooltip shown when hovering over the menu bar item
Tooltip text, or null to remove the tooltip
Object representing a macOS system menu bar item. Create instances with
hs.menubar.create().