Is there any way to change what display style is used with the growlnotify command line utility? I don't want to change the default one, just the one that is used for that instance of the command.


man growlnotify does not allow an option, and growlnotify --help doesn't mention anything either. Which makes sense, because the issuing software does not control the style, you are -- via System Preferences!

But the growlnotify entry there only has a single notification type Command-Line Growl Notification (and not e.g. one notification type per priority). Therefore I don't think it's possible.

You can, however, create an AppleScript application/script that uses the Growl API to issue different types of notifications, based on some parameter. Growl documentation on how to access it via AppleScript.

Here's a sample script for AppleScript Editor:

on run argv
    tell application "GrowlHelperApp"
        set the allNotificationsList to ¬
            {"1", "2"}
        set the enabledNotificationsList to ¬
            {"1", "2"}
        register as application ¬
            "My Growl Notification App" all notifications allNotificationsList ¬
            default notifications enabledNotificationsList ¬
            icon of application "Script Editor"

        notify with name ¬
            (item 1 of argv) title ¬
            (item 2 of argv) description ¬
            (item 3 of argv) application name "My Growl Notification App"
    end tell
end run

"1" and "2" are the names of the supported notification types. Run this script like this:

osascript growlstyle.scpt 2 Hello\ World This\ is\ the\ text

Parameters are (in order) notification type name, title, and description.

alt text

After running it once, you can configure the display settings for the notification types in System Preferences.

alt text

  • You can, of course, use any name you like for your notifications. Since you probably want to specify them on the command line, I used single-character names. – Daniel Beck Dec 23 '10 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.