Sublime Forum

Access Mountain Lion's notifier from a plugin

#1

This is a plugin to allow access to Mountain Lion’s notifier system in a ST2 plugin. It downloads an app from(github.com/alloy/terminal-notifier/downloads) that provides easy access to the notifier and exposes the use of it via a sublime command. Gatekeeper may get in the way if you have it enabled.

Just something I was playing around with.

Usage:

sublime.run_command("notify", {"title": "ST2 Message", "message": "Hello World!"})

Gist:
gist.github.com/3260439

0 Likes

#2

Added access to the other features within the terminal-notifier app.

These are the parameters that are accessible via the ST2 command. The only difference is you would change the open command to open_url. Just use them as arguments in the command. You can play around with them to get a feel for how they work.

[code]Usage: terminal-notifier -[message|remove] [VALUE|ID] [options]

Either of these is required:

   -message VALUE     The notification message.
   -remove ID         Removes a notification with the specified ‘group’ ID.

Optional:

   -title VALUE       The notification title. Defaults to ‘Terminal’.
   -group ID          A string which identifies the group the notifications belong to.
                      Old notifications with the same ID will be removed.
   -activate ID       The bundle identifier of the application to activate when the user clicks the notification.
   -open URL          The URL of a resource to open when the user clicks the notification.
   -execute COMMAND   A shell command to perform when the user clicks the notification.

When the user activates a notification, the results are logged to the system logs.
Use Console.app to view these logs.[/code]

0 Likes