How do I determine whether Growl is running using

2019-06-06 03:32发布

问题:

I the past, in order to determine whether the Growl helper is running on macOS, I've used

tell application "System Events"
    set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
end tell

But recently, both this and an alternative thats been suggested

tell application "System Events" to set isRunning to exists (processes where name is "com.Growl.GrowlHelperApp")

just run forever. This seems to happen (only) when it (or more precisely the app "Hardware Growler" is not running), but is still clearly not the desired outcome.

How do I determine whether Growl is running using AppleScript?

回答1:

While I was not able to identify a process name that hints at GrowlHelper running in the background (Growl 2.13, Mac App Store version), I found an alternative solution.

In fact Growl 2.13 may not even need to use GrowlHelperApp itself to launch on user login.


Check whether Growl is set to launch on login

In Terminal type

defaults read ~/Library/Containers/com.Growl.GrowlHelperApp/Data/Library/Preferences/com.Growl.GrowlHelperApp.plist ShouldStartGrowlAtLogin

This will output a value of 1 (true) or 0 (false). This file is modified every time you toggle the switch in Growl's preferences.