Skip to content
Yoann Gini edited this page Apr 18, 2021 · 13 revisions

Function description

Goal

Allow the creation of a new menu to add into the current one (can be nested).

With this function you will configure the name of the menu item to show in the parent one and the content to the menu associated to the menu item.

If sub menu items has a status, the parent menu item will summarize it by displaying the most critical state.

Settings

The settings dictionary contain all informations you can set to use this function. Here is a description of each.

Key Type Description
title Translatable string (see: Label translation) Item's title shown in the menu
computedTitle Name of the script in Application Support CustomScripts folder First line on stdout will be the title
optionalDisplay Boolean Will show the related item only if option key was pressed when Hello-IT menu was shown (supported in Hello-IT 1.4.0+)
stateSortScenario Integer (optional) Set the priority of OK over unavailable during state summarisation: 0, unavailable win, or 1, OK win. Default is 0
content Array of dict Each dictionary nested in the array will represent function to load in the submenu

Description of nested items

Each dictionary inside the content must match the following description.

Key Type Description
functionIdentifier String Identity of the function to load
settings Dictionary (optional) Settings for the function to load
imagePath String (optional) Full path for the image to display next to the item
imageBaseName String (optional) Base name for the PNG image located in /Library/Application Support/com.github.ygini.hello-it/CustomImageForItem/, more info here
skipForGlobalState Boolean (optional) Do not report the state of this item in the submenu state. Default to false

If imagePath key is not set, Hello IT will look for imageBaseName key. Take care to image size, it will be displayed full size.

Sample settings

<dict>
	<key>functionIdentifier</key>
	<string>public.submenu</string>
	<key>settings</key>
	<dict>
		<key>content</key>
		<array>
			<dict>
				<key>functionIdentifier</key>
				<string>public.test.http</string>
				<key>settings</key>
				<dict>
					<key>URL</key>
					<string>http://captive.apple.com</string>
					<key>mode</key>
					<string>md5</string>
					<key>originalString</key>
					<string>73a78ff5bd7e5e88aa445826d4d6eecb</string>
					<key>repeat</key>
					<integer>60</integer>
					<key>imageBaseName</key>
					<string>network</string>
					<key>title</key>
					<string>Internet</string>
					<key>skipForGlobalState</key>
					<true/>
				</dict>
			</dict>
		</array>
		<key>title</key>
		<string>Services state</string>
	</dict>
</dict>

More informations

Main implementation

The main implementation of this function is made in the SubMenu plugin from the main project.

This function is used by the Hello-IT to create the main menu item. So be careful if you replace it by your own implementation.