Custom Menu Bar Action Items

Jamf Connect allows you to create custom action items in the menu bar app. These items can open URLs or run any script in the background of the computer, allowing you to create a wide variety of powerful and convenient resources for the user. Custom menu bar action items are added to the Jamf Connect menu bar app by deploying an additional configuration profile written to the following domain:

com.jamf.connect.actions

You can create menu bar items to do any of the following and more:

  • Connect the computer to a VPN

  • Display network information in the menu bar

  • Open your organization's website in a web browser

  • Run a script that executes a maintenance policy deployed by your MDM solution

Action Item Configuration Profile Example

<plist version="1.0">
    <dict>
        <key>PayloadType</key>
        <string>Configuration</string>
        <key>PayloadDisplayName</key>
        <string>Jamf Connect Actions</string>
        <key>PayloadDescription</key>
        <string>Jamf Connect Actions</string>
        <key>PayloadOrganization</key>
        <string>Jamf</string>
        <key>PayloadUUID</key>
        <string>27870006-41CB-4694-A6AD-709073670851</string>
        <key>PayloadEnabled</key>
        <true/>
        <key>PayloadScope</key>
        <string>System</string>
        <key>PayloadRemovalDisallowed</key>
        <true/>
        <key>PayloadIdentifier</key>
        <string>com.jamf.connect.actions</string>
        <key>PayloadVersion</key>
        <integer>1</integer>
        <key>PayloadContent</key>
        <array>
            <dict>
                <key>PayloadType</key>
                <string>com.jamf.connect.actions</string>
                <key>PayloadDisplayName</key>
                <string>Jamf Connect Actions</string>
                <key>PayloadDescription</key>
                <string>Jamf Connect Actions Settings</string>
                <key>PayloadOrganization</key>
                <string>Jamf</string>
                <key>PayloadUUID</key>
                <string>98B42AF5-4040-47D1-9F6F-A0E1D7FBFC26</string>
                <key>PayloadVersion</key>
                <integer>1</integer>
                <key>PayloadIdentifier</key>
                <string>com.jamf.connect.actions</string>
                <key>Version</key>
                <integer>1</integer>
                <key>Actions</key>
                <array>
                    <dict>
                        <key>Title</key>
                        <dict>
                            <key>Command</key>
                            <string>path</string>
                            <key>CommandOptions</key>
                            <string>/usr/sbin/ipconfig getifaddr en0</string>
                        </dict>
                        <key>ToolTip</key>
                        <string>Primary IP Address</string>
                        <key>Name</key>
                        <string>en0</string>
                    </dict>
                    <dict>
                        <key>Name</key>
                        <string>Hostname</string>
                        <key>Title</key>
                        <dict>
                            <key>Command</key>
                            <string>path</string>
                            <key>CommandOptions</key>
                            <string>/bin/hostname</string>
                        </dict>
                    </dict>
                    <dict>
                        <key>Name</key>
                        <string>separator</string>
                    </dict>
                    <dict>
                        <key>Action</key>
                        <array>
                            <dict>
                                <key>Command</key>
                                <string>url</string>
                                <key>CommandOptions</key>
                                <string>https://www.jamf.com</string>
                            </dict>
                        </array>
                        <key>Name</key>
                        <string>Open jamf.com in your browser</string>
                    </dict>
                    <dict>
                        <key>Action</key>
                        <array>
                            <dict>
                                <key>Command</key>
                                <string>app</string>
                                <key>CommandOptions</key>
                                <string>/System/Applications/Calculator.app</string>
                            </dict>
                        </array>
                        <key>Name</key>
                        <string>Open the macOS Calculator</string>
                    </dict>
                </array>
            </dict>
        </array>
    </dict>
</plist>

Action Item Preference Key Reference

Within the com.jamf.connect.actions domain, the following preference keys determine the behavior of the menu. The only required part of each item is the name; all other parts are optional. Consider the following when creating menu bar items:

  • The result of any command can be passed on to the next. Using <<result>> as a command option will replace it with the result of the previous command.

  • true or false results are not passed to the next command.

  • Adding true or false at the end of the command will cause that command to run only if the previously run command returns accordingly. For example, using alertTrue as the command name will run the alert command only if the previously run command returns true.

Note:

The result state is persistent, allowing multiple commands to be designated to run or not run depending on a single result. For example, if a result of true is passed to a sequence commands with false modifiers appended to their command names, none of those commands would be run.

Global Preferences

The following table includes the global preferences for a custom menu bar action configuration profile.

Attribute

Description

Type

Required

Version

The numeric version of the preference file. Currently, only 1 is supported

Integer

Yes

MenuIcon

Determines if the action menu will display a status icon (green, yellow, or red)

Note:

MenuIcon will display a green, yellow, or red icon next to the main Action menu based upon the highest degree of alert among all items in the submenu. For example, if you have any visible submenu actions displaying a red icon, the main menu will display a red icon. If any visible submenu actions display a yellow icon and none display red, the main menu item will display a yellow icon.

Boolean

No

MenuText

When set to true, Jamf Connect will use the result of the command as the text of the menu item.

Note:

MenuText requires a command to return a result of <<menu>> followed by your menu. The last command to return a result containing <<menu>> will determine what the menu title is.

Boolean

No

Action Content

Attribute

Description

Type

Required

Name

The name of the action

String

Yes

Title

The text used to display the item in the menu bar

Note:

If unspecified, the Name will be used as the title.

Dictionary

No

Show

Determines if the item is displayed in the menu or not

Note:

All commands in the Show command must return true for the menu item to display.

Array

No

Action

Contains the action

 

Array

No

Post

Determines what happens after the action is run.

Array

No

GUID

The unique ID for the action

String

No

Connected

Determines if the action set should only be run when connected to an Active Directory domain

Boolean

No

Timer

Length in minutes between executing the action

Integer

No

 

ToolTip

The text displayed when hovering over a menu item

String

No

Separator

Creates a visual separator bar in the menu bar

 

 

Commands

The Jamf Connect has built-in commands that can be used to execute action items. Consider the following about commands:

  • All options are strings.

  • All commands can return results.

  • Results do not persist between commands.

  • CommandOptions support the standard Jamf Connect variables such as <<domain>>, <<user>>, and <<email>>.

  • Commands are case sensitive.

Command

Function

Command Options

path

Executes a binary at a specific file path

The path to execute

app

Opens an application at a specific file path

The path of the application to open

url

Opens a URL in the user's default browser

The URL to open

ping

Pings a host

The host to ping

adgroup

Determine if the current user is a member of an Active Directory group

The group to test

alert

Displays a modal dialog to the user

 

The alert text

Note:

If the command options are blank or are either "true" or "false", no alert will display. You can use this to show only errors.

notify

Displays a notification in the notification center

 

The notification text

Note:

If the command options are blank or are either "true" or "false", no notification will display. You can use this to show only errors.

false

A command that always returns false. This could be used to clear previous results in a command set

Text

true

A command that always returns true. This could be used to clear previous results in a command set

Text