Skip to content

Instantly share code, notes, and snippets.

@alloy
Forked from tenpaiyomi/gist:22407
Created November 5, 2008 19:33
Show Gist options
  • Save alloy/22408 to your computer and use it in GitHub Desktop.
Save alloy/22408 to your computer and use it in GitHub Desktop.
class MenuBarController
def initialize
# Create our status bar for the application
puts "Initializing....."
# menuZone = NSMenu.menuZone()
# menu = NSMenu.allocWithZone(menuZone)
menuItem = NSStatusBar.systemStatusBar.statusItemWithLength(NSVariableStatusItemLength)
# And set it's details
menuItem.setHighlightMode(true)
menuItem.setImage(NSImage.imageNamed("MenuBarIcon.png"))
menuItem.setTarget(self)
menuItem.setAction('displayInformationWindow:')
menuItem.setEnabled(true)
puts "Initialized"
# Also, create a window
end
def displayInformationWindow(menuItem)
puts "Clicked!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment