Home Download Buy Blog Forum Support

Access Mountain Lion's notifier from a plugin

Access Mountain Lion's notifier from a plugin

Postby facelessuser on Sat Aug 04, 2012 4:48 am

This is a plugin to allow access to Mountain Lion's notifier system in a ST2 plugin. It downloads an app from(https://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:
Code: Select all
sublime.run_command("notify", {"title": "ST2 Message", "message": "Hello World!"})


Gist:
https://gist.github.com/3260439
facelessuser
 
Posts: 1460
Joined: Tue Apr 05, 2011 7:38 pm

Re: Access Mountain Lion's notifier from a plugin

Postby facelessuser on Sat Aug 04, 2012 11:06 pm

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: Select all
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.
facelessuser
 
Posts: 1460
Joined: Tue Apr 05, 2011 7:38 pm


Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 9 guests

cron