From 6b694cda51b9deda031a5678ed6131273e9a9484 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 14 Sep 2015 14:08:52 -0700 Subject: [PATCH] Add multimonitor support --- .hammerspoon/init.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.hammerspoon/init.lua b/.hammerspoon/init.lua index 483bdd8..51a48b4 100644 --- a/.hammerspoon/init.lua +++ b/.hammerspoon/init.lua @@ -17,13 +17,25 @@ local topright = {x=1,y=0,w=1,h=1} local bottomleft = {x=0,y=1,w=1,h=1} local bottomright = {x=1,y=1,w=1,h=1} local full = {x=0,y=0,w=2,h=2} +local first = hs.screen.allScreens()[3] +local second = hs.screen.allScreens()[2] +local third = hs.screen.allScreens()[1] function sendTo(area) local win = hs.window.focusedWindow() - local screen = hs.screen.mainScreen() + local screen = win:screen() hs.grid.set(win,area,screen) end +function selectWindow() + hs.hints.windowHints() +end + +function moveToScreen(screen) + local win = hs.window.focusedWindow() + win:moveToScreen(screen,0) +end + k:bind({}, 'escape', function() k:exit() end) k:bind({}, 'h', function() sendTo(left) end) k:bind({}, 'j', function() sendTo(bottom) end) @@ -35,6 +47,11 @@ k:bind({}, 'b', function() sendTo(bottomleft) end) k:bind({}, 'n', function() sendTo(bottomright) end) k:bind({}, 'f', function() sendTo(full) end) +hs.hotkey.bind({"cmd","ctrl"}, 'f', function() selectWindow() end) +k:bind({"shift"}, 'a', function() moveToScreen(first) end) +k:bind({"shift"}, 'o', function() moveToScreen(second) end) +k:bind({"shift"}, 'e', function() moveToScreen(third) end) + function reload_config(files) hs.reload() end