[hammerspoon] Restore window management throws

pull/28/head
Alpha Chen 9 years ago
parent 89a5c3268f
commit 9b1dc5e35f

@ -1,6 +1,10 @@
local mash = {"cmd", "alt", "ctrl"} local mash = {"cmd", "alt", "ctrl"}
local smash = {"cmd", "alt", "ctrl", "shift"} local smash = {"cmd", "alt", "ctrl", "shift"}
function current_app()
return hs.application.frontmostApplication()
end
-- Application shortcuts -- Application shortcuts
local wf = hs.window.filter local wf = hs.window.filter
@ -16,7 +20,6 @@ end):subscribe(wf.windowUnfocused, function()
safari_esc:disable() safari_esc:disable()
end) end)
-- 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)
@ -27,36 +30,35 @@ end)
-- Window management -- Window management
-- hs.hotkey.bind(mash, "h", function() local throw_left = function()
-- local win = hs.window.focusedWindow() local win = hs.window.focusedWindow()
-- local f = win:frame() local f = win:frame()
-- local screen = win:screen() local screen = win:screen()
-- local max = screen:frame() 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() f.x = max.x
-- local win = hs.window.focusedWindow() f.y = max.y
-- local f = win:frame() f.w = max.w / 2
-- local screen = win:screen() f.h = max.h
-- local max = screen:frame() win:setFrame(f)
end
-- f.x = max.x + (max.w / 2) local throw_right = function()
-- f.y = max.y local win = hs.window.focusedWindow()
-- f.w = max.w / 2 local f = win:frame()
-- f.h = max.h local screen = win:screen()
-- win:setFrame(f) local max = screen:frame()
-- end)
function current_app() f.x = max.x + (max.w / 2)
return hs.application.frontmostApplication() f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end end
hs.hotkey.bind(mash, "h", throw_left)
hs.hotkey.bind(mash, "l", throw_right)
hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", function() hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", function()
hs.reload() hs.reload()
end):start() end):start()

Loading…
Cancel
Save