Skip to content

Instantly share code, notes, and snippets.

@Watson1978
Created July 26, 2012 01:35
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Watson1978/3179756 to your computer and use it in GitHub Desktop.
Save Watson1978/3179756 to your computer and use it in GitHub Desktop.
MacRuby : Mountain Lion + Notification
#
# AppDelegate.rb
# notify
#
# Created by watson on 2012/07/26.
#
module Notification
module_function
def send(title, text)
notification = NSUserNotification.alloc.init
notification.title = title
notification.informativeText = text
center = NSUserNotificationCenter.defaultUserNotificationCenter
center.scheduleNotification(notification)
end
end
class AppDelegate
attr_accessor :window
def applicationDidFinishLaunching(a_notification)
Notification.send("title", "text")
end
end
@wmarbut
Copy link

wmarbut commented Jul 30, 2012

Such a shame that you have to be in an apple bundle for this to work. Could see all kinds of ideas with this working from just scripts. Guess it may be time to fire up xcode and write a helper app.

@mrmurphy
Copy link

Thanks for posting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment