aboutsummaryrefslogtreecommitdiffstats
path: root/init.lua
diff options
context:
space:
mode:
authorTeddy Wing2019-06-10 21:52:39 +0200
committerTeddy Wing2019-06-15 20:30:49 +0200
commit644cdb4d9fd40d32248f7f5faabbf3be9704b5fe (patch)
treecba70ec2158325a33e2f59d8a1c72f7dc923c880 /init.lua
parentf4859089de29e4b7fe4e92c0c1f1341c12eb2363 (diff)
downloaddothammerspoon-644cdb4d9fd40d32248f7f5faabbf3be9704b5fe.tar.bz2
Add window movement hotkeys
Create a new mode activated with <C-M-S-w> that activates hotkeys to do window management. Add hotkeys to move windows up, down, left, and right. One set of hotkeys to move by small increments and another set to move by slightly larger increments. Based on code from 'derekwyatt' (https://github.com/derekwyatt): https://github.com/fikovnik/ShiftIt/issues/296#issuecomment-438386501 > units = { > right30 = { x = 0.70, y = 0.00, w = 0.30, h = 1.00 }, > right70 = { x = 0.30, y = 0.00, w = 0.70, h = 1.00 }, > left70 = { x = 0.00, y = 0.00, w = 0.70, h = 1.00 }, > left30 = { x = 0.00, y = 0.00, w = 0.30, h = 1.00 }, > top50 = { x = 0.00, y = 0.00, w = 1.00, h = 0.50 }, > bot50 = { x = 0.00, y = 0.50, w = 1.00, h = 0.50 }, > upright30 = { x = 0.70, y = 0.00, w = 0.30, h = 0.50 }, > botright30 = { x = 0.70, y = 0.50, w = 0.30, h = 0.50 }, > upleft70 = { x = 0.00, y = 0.00, w = 0.70, h = 0.50 }, > botleft70 = { x = 0.00, y = 0.50, w = 0.70, h = 0.50 }, > maximum = { x = 0.00, y = 0.00, w = 1.00, h = 1.00 } > } > > mash = { 'shift', 'ctrl', 'cmd' } > hs.hotkey.bind(mash, 'l', function() hs.window.focusedWindow():move(units.right30, nil, true) end) > hs.hotkey.bind(mash, 'h', function() hs.window.focusedWindow():move(units.left70, nil, true) end) > hs.hotkey.bind(mash, 'k', function() hs.window.focusedWindow():move(units.top50, nil, true) end) > hs.hotkey.bind(mash, 'j', function() hs.window.focusedWindow():move(units.bot50, nil, true) end) > hs.hotkey.bind(mash, ']', function() hs.window.focusedWindow():move(units.upright30, nil, true) end) > hs.hotkey.bind(mash, '[', function() hs.window.focusedWindow():move(units.upleft70, nil, true) end) > hs.hotkey.bind(mash, ';', function() hs.window.focusedWindow():move(units.botleft70, nil, true) end) > hs.hotkey.bind(mash, "'", function() hs.window.focusedWindow():move(units.botright30, nil, true) end) > hs.hotkey.bind(mash, 'm', function() hs.window.focusedWindow():move(units.maximum, nil, true) end)
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index 28e7bd2..4760509 100644
--- a/init.lua
+++ b/init.lua
@@ -1,6 +1,8 @@
-- Enable command line tool (http://www.hammerspoon.org/docs/hs.ipc.html)
require("hs.ipc")
+require('window')
+
-- Shortcuts to focus tabs in Terminal
terminal_app = hs.application.applicationsForBundleID('com.apple.Terminal')[1]