Skip to content

Instantly share code, notes, and snippets.

@Twipped
Created August 19, 2011 16:56
Show Gist options
  • Save Twipped/1157332 to your computer and use it in GitHub Desktop.
Save Twipped/1157332 to your computer and use it in GitHub Desktop.
Local mail growl notification
#!/bin/bash
export mvar=`mail -H |tail -1 |sed -n 's/\(..*"\)\([^"][^"].*\)\(["].*\)/\2/p'`
/usr/bin/osascript <<-EOF 2>/dev/null 1>&2
tell application "GrowlHelperApp"
try
set the allNotificationsList to ¬
{"Unix Mail Notification"}
set the enabledNotificationsList to ¬
{"Unix Mail Notification"}
register as application ¬
"Growls Unix Mail Notification" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Terminal.app"
-- Send a Notification...
notify with name ¬
"Unix Mail Notification" title ¬
"Unix Mail Notification" description ¬
"$mvar" application name "Growls Unix Mail Notification" icon of application "Terminal.app"
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"Cancel"} default button 1
end try
end tell
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment