Skip to content

Instantly share code, notes, and snippets.

@norio
Created December 12, 2008 05:44
Show Gist options
  • Save norio/35028 to your computer and use it in GitHub Desktop.
Save norio/35028 to your computer and use it in GitHub Desktop.
undefined
require 'rubygems'
require 'osx/cocoa'
require 'osx/hotkey'
def open_app(name)
`open /Applications/#{name}.app`
end
hotkeys = 'Command+Control'
app_list = {
'WebKit' => 'w',
'Firefox' => 'f',
'TextMate' => 'e',
'Yummy\ FTP' => 'r',
'1Password' => '1',
'Path\ Finder'=> '2',
'PeraPeraPrv' => '3',
'Gmail' => 'g',
'OmniFocus' => 'o',
'Utilities/Terminal' => 't',
}
app = NSApplicationWithHotKey.sharedApplication
app_list.each do |name, key|
app.register_hotkey("#{hotkeys}+#{key}") { open_app(name) }
end
app.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment