Skip to content

Instantly share code, notes, and snippets.

@tenpaiyomi
Created November 5, 2008 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tenpaiyomi/22407 to your computer and use it in GitHub Desktop.
Save tenpaiyomi/22407 to your computer and use it in GitHub Desktop.
class MenuBarController
def init
if super
# 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
return self
end
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