Skip to content

Instantly share code, notes, and snippets.

@glejeune
Forked from chapados/shortcutapp.rb
Created March 12, 2010 18:45
Show Gist options
  • Save glejeune/330609 to your computer and use it in GitHub Desktop.
Save glejeune/330609 to your computer and use it in GitHub Desktop.
require "shortcut"
require 'hotcocoa'
class Application
include HotCocoa
def start
application :name => "Shortcut" do |app|
app.delegate = self
window :frame => [100, 100, 500, 500], :title => "Shortcut" do |win|
win << label(:text => "Hello from HotCocoa", :layout => {:start => false})
win << label(:text => "Press Control+Option+Space to pop-up a window", :layout => {:start => false})
win.will_close { exit }
end
end
end
def applicationDidFinishLaunching(sender)
install_shortcut
end
def install_shortcut
@shortcut = Shortcut.new
@shortcut.delegate = self
@shortcut.addShortcut
end
def hotkeyWasPressed
window :size => [250, 50] do |win|
my_label = label(:text => "You pressed Control+Option+Space", :layout => {:expand => :width, :start => false})
win << my_label
end
end
end
Application.new.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment