Skip to content
Yoann Gini edited this page Mar 14, 2016 · 13 revisions

Introduction

This function allow us to create a new MenuList 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 MenuList 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.

Main implementation

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

Settings

  • "title" a string to display in the parent menu item ;
  • "content" an array of dictionary describing included functions.

Those dictionaries must contains the following keys:

  • "functionIdentifier" a string to identify with function you want to load ; and may contains those:
  • "settings" a dictionary of options to pass to the function, read the function doc to know more about this.

State

If submenu items display a status via a testState property (like built-in test functions) the menu will automatically resume it in its own state.

You can avoid this behavior by setting the skipForGlobalState key to NO in sub item settings dictionary. For example, the Internet state wont be taken as a watched state:

...
        <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>title</key>
                            <string>Internet</string>
                            <key> skipForGlobalState </key>
                            </true>
                        </dict>
                    </dict>
                </array>
                <key>title</key>
                <string>Services state</string>
            </dict>
        </dict>
...

Notes

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