Menu Close

Jamf Pro Self Service racing stripes when using Installomator with swiftDialog

A collection of modifications to enhance your users’ experience when using swiftDialog and Installomator with Jamf Pro’s Self Service

Installomator with swiftDialog racing stripes screencast (01:31; no audio)

Background

As a self-proclaimed swiftDialog evangelist, I was especially excited when Installomator v10.0 was released earlier this month with Jamf Pro-specific examples from Armin Briegel and Søren Theilgaard.

This article presumes you’ve successfully implemented Installomator with swiftDialog into your Jamf Pro Self Service policies and then builds on Armin’s, Bart’s and Søren’s work by adding some so-called “racing stripes” based on previous posts, which we’re still testing out in our lower-lanes.

Branded Notifications

Our first “racing stripe” for each Installomator policy is a branded macOS Notifications via swiftDialog to provide the user with immediate feedback about what’s happening:

macOS Notifications via swiftDialog (0.0.1)

Overlay Icon

Next, we leverage the same custom Jamf Pro Self Service icon as an overlayicon in the swiftDialog-generated progress window (which was submitted as Pull Request #778).

Instant branding with overlayicon
Instant branding with overlayicon
# MARK: Configure and display swiftDialog

+ # Use Self Service's icon for the overlayicon
+ overlayicon=$( defaults read /Library/Preferences/com.jamfsoftware.jamf.plist self_service_app_path )
+ 
# display first screen
open -a "$dialogApp" --args \
         --title none \
         --icon "$icon" \
+        --overlayicon "$overlayicon" \
         --message "$message" \
         --mini \
         --progress 100 \

Title none?

While we’re big, big fans of mini mode dialogs, we’re leaning toward including a title:

We made the following modifications to include title and some static text for message:

# MARK: Configure and display swiftDialog

+ # Use Self Service's icon for the overlayicon
+ overlayicon=$( defaults read /Library/Preferences/com.jamfsoftware.jamf.plist self_service_app_path )
+ 
# display first screen
open -a "$dialogApp" --args \
+        --title "$message" \
         --icon "$icon" \
+        --overlayicon "$overlayicon" \
+        --message "Installing $message …" \
         --mini \
         --progress 100 \

Auto-reveal Installed App

To make it easy for the users to start using their newly installed app, we’re adding the following one-liner to each of our Installomator policies via the Files and Processes payload, Execute Command; a previous post provides additional details.

Auto-reveal Installed App
appName=$( grep "Executing Policy Installomator: " /private/var/log/jamf.log | sed -n -e 's/^.*Executing Policy Installomator: //p' | tail -1 ) ; /usr/bin/open -R "/Applications/${appName}.app" ; /usr/local/bin/jamf policy -trigger updateComputerInventory

Inventory Update Progress

Next, we added updateComputerInventory as a Custom Event to our Inventory Update Progress with swiftDialog policy:

Refresh Self Service

Finally, our Inventory Update Progress policy auto-refreshes Self Service, using the following one-liner:

/usr/bin/su \- "`/usr/bin/stat -f%Su /dev/console`" -c "/usr/bin/osascript -e 'tell application \"Self Service\" to activate' -e 'tell application \"System Events\" to key code 53' -e 'tell application \"System Events\" to keystroke \"r\" using {command down}'"

Conclusion

Since recording the screencast for this post, we’ve added --position bottomright to our Inventory Update Progress script to have its initial display be more consistent with the Installomator’s.

While the current inclusion of the seemingly superfluous branded Notification for our Installomator policies is perhaps overkill, I’m trying to slowly introduce the branded, swiftDialog-generated Notifications to our users.

Updates

02-Dec-2022

While implementing these changes in our lower-lanes, we submitted Pull Request #794 to include the version number in progresstext:

            echo "progress: $progress" >> $cmd_file
         fi
         if [[ $message != "" ]]; then
+             if [[ $appNewVersion != "" ]]; then
+                 appVersionProgressText=${appNewVersion// /}
+                 echo "progresstext: v$appVersionProgressText $message" >> $cmd_file
+             else
+                 echo "progresstext: $message" >> $cmd_file
+             fi
         fi
     else
         # list item has a value, so we update the progress and text in the list
Posted in Jamf Pro, macOS, Scripts, Tips & Tricks

Related Posts