Skip to content

Instantly share code, notes, and snippets.

@Watson1978
Created October 8, 2011 08:43
Show Gist options
  • Save Watson1978/1272037 to your computer and use it in GitHub Desktop.
Save Watson1978/1272037 to your computer and use it in GitHub Desktop.
MacRuby : terminate the running applications
framework 'AppKit'
IGNORE = {
'com.apple.finder' => true,
'com.apple.Terminal' => true,
}
apps = NSWorkspace.sharedWorkspace.runningApplications
apps.each do |app|
if app.activationPolicy == NSApplicationActivationPolicyRegular
app.terminate unless IGNORE[app.bundleIdentifier]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment