Created
May 20, 2009 00:17
-
-
Save chapados/114523 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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