Skip to content

Instantly share code, notes, and snippets.

@scutdavy
Created August 20, 2013 02:34
Show Gist options
  • Save scutdavy/6276515 to your computer and use it in GitHub Desktop.
Save scutdavy/6276515 to your computer and use it in GitHub Desktop.
require '~/Applications/Zephyros.app/Contents/Resources/libs/zephyros.rb'
hyper = ["cmd", "alt", "ctrl", "shift"]
#hyper = ["cmd", "alt", "ctrl"]
$window_grid_width = 4
API.bind('d', hyper) { `open -a Dictionary` }
API.bind 'f', hyper do
API.focused_window.maximize()
end
API.bind '1', hyper do
API.focused_window.move_to_left()
end
API.bind '2', hyper do
API.focused_window.move_to_right()
end
API.bind '`', hyper do
API.focused_window.move_to_full_screen()
end
API.bind 'c', hyper do
API.alert API.clipboard_contents
end
def max_width
API.main_screen.frame_without_dock_or_menu.w
end
def max_height
API.main_screen.frame_without_dock_or_menu.h
end
class Window
def move_to_left
self.move do |frame|
frame.x = 0
frame.y = 0
frame.w = max_width / 2
frame.h = max_height
frame
end
end
def move_to_right
self.move do |frame|
frame.x = max_width/2
frame.y = 0
frame.w = max_width / 2
frame.h = max_height
frame
end
end
def move_to_full_screen
self.move do |frame|
frame.x = 0
frame.y = 0
frame.w = max_width
frame.h = max_height
frame
end
end
def move
self.frame = yield self.frame
end
end
wait_on_callbacks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment