2

Is there a way to disable Growl notifications automatically when a certain app is running, Quick Time for example. I don't want to get the notifications while watching a movie.

1

1 Answer 1

1

Full credit to @ghoppe over at Super User for this excellent answer. I'm only duplicating it here because a moderator on Meta suggested that it would be appropriate to do so.

Please note that this solution will suppress Growl when VLC (media player) is running. To make it work for another application (e.g. QuickTime), you'll have to modify the Applescript. If you've tried yourself but still need help, I would suggest posting a question about it over at Stack Overflow.

Original answer follows:


Enter in Applescript Editor, save as application, when saving check the box "Stay Open". Use this new applescript application to launch the VLC application.

Description: It will launch VLC, turn off growl notifications, check every 2s to see if VLC has quit, if so it will turn growl notifications back on and then quit. As a bonus, it will use growl notifications to notify you when growl notifications will be turned on or off.

global Growl_was_Loaded    
global VLC_is_Loaded    

on run    
    set Growl_was_Loaded to isAppLoaded("GrowlHelperApp")    
    set VLC_is_Loaded to isAppLoaded("VLC")    
    launchVLC()    
    idle    
end run    

on idle    
    set x to isAppLoaded("VLC")    
    if x and not VLC_is_Loaded then    
        launchVLC()    
    else if VLC_is_Loaded and not x then    
        set VLC_is_Loaded to false    
        if Growl_was_Loaded then    
            tell application "GrowlHelperApp" to launch    
            growl_notify("Growl notifications have been turned ON")    
        end if    
        tell me to quit    
    end if    
    return 2 -- wait 2 seconds    
end idle    

on launchVLC()    
    tell application "VLC" to launch    
    if Growl_was_Loaded then    
        growl_notify("Launching VLC… Growl notifications have been turned OFF")    
        delay 1    
        tell application "GrowlHelperApp" to quit    
    end if    
    set VLC_is_Loaded to true    
end launchVLC    

on isAppLoaded(app_name)    
    tell application "System Events"    
        set app_list to every application process whose name is app_name    
        if the (count of app_list) > 0 then    
            set x to true    
        else    
            set x to false    
        end if    
    end tell    
    return x    
end isAppLoaded    

on growl_notify(msg)    
    tell application "GrowlHelperApp"    
        set the allNotificationsList to {"Growl Toggler"}    
        register as application "Growl Toggler" all notifications allNotificationsList default notifications allNotificationsList    
        notify with name "Growl Toggler" title msg description "" application name "Growl Toggler" icon of application "Automator"    
    end tell    
end growl_notify    
2
  • 1
    Made it a community wiki so I don't get credit for someone else's answer. If you like it, please also vote up the original question over at Super User (linked in the answer above).
    – Austin
    Commented May 11, 2011 at 3:17
  • Thanks! I'll try to edit the script to work with other apps. I'll post the result.
    – Abdullah
    Commented May 12, 2011 at 22:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .