[hammerspoon] Add mash shortcuts for throwing windows to the left and right

pull/28/head
Alpha Chen 10 years ago
parent acab0a57d2
commit 443ac26ab1

@ -1,3 +1,7 @@
local mash = {"cmd", "alt", "ctrl"}
-- Application shortcuts
hs.hotkey.bind({"cmd", "shift"}, "{", function() hs.hotkey.bind({"cmd", "shift"}, "{", function()
current_app():selectMenuItem({"Window", "Select Previous Tab"}) current_app():selectMenuItem({"Window", "Select Previous Tab"})
end) end)
@ -6,6 +10,34 @@ hs.hotkey.bind({"cmd", "shift"}, "}", function()
current_app():selectMenuItem({"Window", "Select Previous Tab"}) current_app():selectMenuItem({"Window", "Select Previous Tab"})
end) end)
-- Window management
hs.hotkey.bind(mash, "h", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end)
hs.hotkey.bind(mash, "l", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x + (max.w / 2)
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end)
function current_app() function current_app()
return hs.window.application() return hs.window.application()
end end

Loading…
Cancel
Save