Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Created July 15, 2012 14:44
Show Gist options
  • Save fjolnir/3117250 to your computer and use it in GitHub Desktop.
Save fjolnir/3117250 to your computer and use it in GitHub Desktop.
nsapp = NSApplication sharedApplication
\ Create the menubar
menuBar = NSMenu new
appMenuItem = NSMenuItem new
menuBar addItem: appMenuItem
nsapp setMainMenu: menuBar
\ Add the Application menu & the quit item
appMenu = NSMenu new
quitMenuItem = NSMenuItem alloc initWithTitle: "Quit #{NSProcessInfo processInfo processName}"
action: "terminate:"
keyEquivalent: "q"
appMenu addItem: quitMenuItem
appMenuItem setSubmenu: appMenu
\ Create a window
win = NSWindow alloc initWithContentRect: #[[0,0], [200,200]]
styleMask: 1
backing: 2
defer: 0
win setTitle: "Tranquil!"
win makeKeyAndOrderFront: nil
\ Start the app
nsapp setActivationPolicy: 0
nsapp activateIgnoringOtherApps: 1
nsapp run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment