You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: extensions/menubar/libmenubar.m
+25-30Lines changed: 25 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -751,19 +751,15 @@ static int menubarSetClickCallback(lua_State *L) {
751
751
///
752
752
/// Parameters:
753
753
/// * `menuTable`:
754
-
/// * If this argument is `nil`:
755
-
/// * Removes any previously registered menu
756
-
/// * If this argument is a table:
757
-
/// * Sets the menu for this menubar item to the supplied table. The format of the table is documented below
758
-
/// * If this argument is a function:
759
-
/// * The function will be called each time the user clicks on the menubar item and the function should return a table that specifies the menu to be displayed. The table should be of the same format as described below. The function can optionally accept a single argument, which will be a table containing boolean values indicating which keyboard modifiers were held down when the menubar item was clicked; The possible keys are:
760
-
/// * cmd
761
-
/// * alt
762
-
/// * shift
763
-
/// * ctrl
764
-
/// * fn
765
-
///
766
-
/// Table Format:
754
+
/// * If this argument is `nil`: Removes any previously registered menu
755
+
/// * If this argument is a table: Sets the menu for this menubar item to the supplied table. The format of the table is documented below
756
+
/// * If this argument is a function: The function will be called each time the user clicks on the menubar item and the function should return a table that specifies the menu to be displayed. The table should be of the same format as described below. The function can optionally accept a single argument, which will be a table containing boolean values indicating which keyboard modifiers were held down when the menubar item was clicked; The possible keys are:
757
+
/// * cmd
758
+
/// * alt
759
+
/// * shift
760
+
/// * ctrl
761
+
/// * fn
762
+
/// * Table Format:
767
763
/// ```
768
764
/// {
769
765
/// { title = "my menu item", fn = function() print("you clicked my menu item!") end },
@@ -773,23 +769,22 @@ static int menubarSetClickCallback(lua_State *L) {
773
769
/// { title = "checked item", checked = true },
774
770
/// }
775
771
/// ```
776
-
/// * The available keys for each menu item are (note that `title` is the only required key -- all other keys are optional):
777
-
/// * `title` - A string or `hs.styledtext` object to be displayed in the menu. If this is the special string `"-"` the item will be rendered as a menu separator. This key can be set to the empty string (""), but it must be present.
778
-
/// * `fn` - A function to be executed when the menu item is clicked
779
-
/// * The function will be called with two arguments. The first argument will be a table containing boolean values indicating which keyboard modifiers were held down when the menubar item was clicked (see `menuTable` parameter for possible keys) and the second is the table representing the item.
780
-
/// * `checked` - A boolean to indicate if the menu item should have a checkmark (by default) next to it or not. Defaults to false.
781
-
/// * `state` - a text value of "on", "off", or "mixed" indicating the menu item state. "on" and "off" are equivalent to `checked` being true or false respectively, and "mixed" will have a dash (by default) beside it.
782
-
/// * `disabled` - A boolean to indicate if the menu item should be unselectable or not. Defaults to false (i.e. menu items are selectable by default)
783
-
/// * `menu` - a table, in the same format as above, which will be presented as a sub-menu for this menu item.
784
-
/// * a menu item that is disabled and has a sub-menu will show the arrow at the right indicating that it has a sub-menu, but the items within the sub-menu will not be available, even if the sub-menu items are not disabled themselves.
785
-
/// * a menu item with a sub-menu is also a clickable target, so it can also have an `fn` key.
786
-
/// * `image` - An image to display in the menu to the right of any state image or checkmark and to the left of the menu item title. This image is not constrained by the size set with [hs.menubar:stateImageSize](#stateImageSize), so you should adjust it with `hs.image:setSize` if your image is extremely large or small.
787
-
/// * `tooltip` - A tool tip to display if you hover the cursor over a menu item for a few seconds.
788
-
/// * `shortcut` - A string containing a single character, which will be used as the keyboard shortcut for the menu item. Note that if you use a capital letter, the Shift key will be required to activate the shortcut.
789
-
/// * `indent` - An integer from 0 to 15 indicating how far to the right a menu item should be indented. Defaults to 0.
790
-
/// * `onStateImage` - An image to display when `checked` is true or `state` is set to "on". This image size is constrained to the size set by [hs.menubar:stateImageSize](#stateImageSize). If this key is not set, a checkmark will be displayed for checked or "on" menu items.
791
-
/// * `offStateImage` - An image to display when `checked` is false or `state` is set to "off". This image size is constrained to the size set by [hs.menubar:stateImageSize](#stateImageSize). If this key is not set, no special marking appears next to the menu item.
792
-
/// * `mixedStateImage` - An image to display when `state` is set to "mixed". This image size is constrained to the size set by [hs.menubar:stateImageSize](#stateImageSize). If this key is not set, a dash will be displayed for menu items with a state of "mixed".
772
+
/// * The available keys for each menu item are (note that `title` is the only required key -- all other keys are optional):
773
+
/// * `title` - A string or `hs.styledtext` object to be displayed in the menu. If this is the special string `"-"` the item will be rendered as a menu separator. This key can be set to the empty string (""), but it must be present.
774
+
/// * `fn` - A function to be executed when the menu item is clicked. The function will be called with two arguments. The first argument will be a table containing boolean values indicating which keyboard modifiers were held down when the menubar item was clicked (see `menuTable` parameter for possible keys) and the second is the table representing the item.
775
+
/// * `checked` - A boolean to indicate if the menu item should have a checkmark (by default) next to it or not. Defaults to false.
776
+
/// * `state` - a text value of "on", "off", or "mixed" indicating the menu item state. "on" and "off" are equivalent to `checked` being true or false respectively, and "mixed" will have a dash (by default) beside it.
777
+
/// * `disabled` - A boolean to indicate if the menu item should be unselectable or not. Defaults to false (i.e. menu items are selectable by default)
778
+
/// * `menu` - a table, in the same format as above, which will be presented as a sub-menu for this menu item.
779
+
/// * A menu item that is disabled and has a sub-menu will show the arrow at the right indicating that it has a sub-menu, but the items within the sub-menu will not be available, even if the sub-menu items are not disabled themselves.
780
+
/// * A menu item with a sub-menu is also a clickable target, so it can also have an `fn` key.
781
+
/// * `image` - An image to display in the menu to the right of any state image or checkmark and to the left of the menu item title. This image is not constrained by the size set with [hs.menubar:stateImageSize](#stateImageSize), so you should adjust it with `hs.image:setSize` if your image is extremely large or small.
782
+
/// * `tooltip` - A tool tip to display if you hover the cursor over a menu item for a few seconds.
783
+
/// * `shortcut` - A string containing a single character, which will be used as the keyboard shortcut for the menu item. Note that if you use a capital letter, the Shift key will be required to activate the shortcut.
784
+
/// * `indent` - An integer from 0 to 15 indicating how far to the right a menu item should be indented. Defaults to 0.
785
+
/// * `onStateImage` - An image to display when `checked` is true or `state` is set to "on". This image size is constrained to the size set by [hs.menubar:stateImageSize](#stateImageSize). If this key is not set, a checkmark will be displayed for checked or "on" menu items.
786
+
/// * `offStateImage` - An image to display when `checked` is false or `state` is set to "off". This image size is constrained to the size set by [hs.menubar:stateImageSize](#stateImageSize). If this key is not set, no special marking appears next to the menu item.
787
+
/// * `mixedStateImage` - An image to display when `state` is set to "mixed". This image size is constrained to the size set by [hs.menubar:stateImageSize](#stateImageSize). If this key is not set, a dash will be displayed for menu items with a state of "mixed".
0 commit comments