A ShiftIt like Hammerspoon window management configuration
A ShiftIt like Hammerspoon window management configuration.
Step 1
Install Hammerspoon if you haven't yet. Download the latest release here and drag it to
/Applications.
Alternatively you can install it using brew:
bash brew cask install hammerspoon
Step 2
Make sure Hammerspoon is started (You should see the a Hammerspoon logo in your menubar).
Download the ShiftIt spoon. Unzip it and open the spoon.
Hammerspoon should prompt that the newly installed spoon is now available.
Alternatively you can use SpoonInstall
Step 3
Click on the Hammerspoon menubar icon and click on 'Open Config'. An
init.luafile should now open in your editor of choice.
Paste the following configuration in the
init.luafile, save it and close it.
hs.loadSpoon("ShiftIt") spoon.ShiftIt:bindHotkeys({})
Click on the Hammerspoon menubar icon again, and click on 'Reload Config'.
The ShiftIt spoon is now ready to use, enjoy.
ctrl(^) + alt(⌥) + cmd(⌘) + leftSnap current window to the left half to the screen
ctrl(^) + alt(⌥) + cmd(⌘) + rightSnap current window to the right half to the screen
ctrl(^) + alt(⌥) + cmd(⌘) + upSnap current window to the top half to the screen
ctrl(^) + alt(⌥) + cmd(⌘) + downSnap current window to the bottom half to the screen
ctrl(^) + alt(⌥) + cmd(⌘) + 1Snap current window to the left top quarter to the screen
ctrl(^) + alt(⌥) + cmd(⌘) + 2Snap current window to the right top quarter to the screen
ctrl(^) + alt(⌥) + cmd(⌘) + 3Snap current window to the left bottom quarter to the screen
ctrl(^) + alt(⌥) + cmd(⌘) + 4Snap current window to the right bottom quarter to the screen
ctrl(^) + alt(⌥) + cmd(⌘) + MMaximise current window
ctrl(^) + alt(⌥) + cmd(⌘) + CCentralize current window
ctrl(^) + alt(⌥) + cmd(⌘) + -Make current window smaller
ctrl(^) + alt(⌥) + cmd(⌘) + =Make current window bigger
ctrl(^) + alt(⌥) + cmd(⌘) + FToggle full screen for current window
ctrl(^) + alt(⌥) + cmd(⌘) + ZToggle zoom for current window
ctrl(^) + alt(⌥) + cmd(⌘) + NMove current window to next screen
ctrl(^) + alt(⌥) + cmd(⌘) + PMove current window to previous screen
The default key mapping looks like this:
{ left = {{ 'ctrl', 'alt', 'cmd' }, 'left' }, right = {{ 'ctrl', 'alt', 'cmd' }, 'right' }, up = {{ 'ctrl', 'alt', 'cmd' }, 'up' }, down = {{ 'ctrl', 'alt', 'cmd' }, 'down' }, upleft = {{ 'ctrl', 'alt', 'cmd' }, '1' }, upright = {{ 'ctrl', 'alt', 'cmd' }, '2' }, botleft = {{ 'ctrl', 'alt', 'cmd' }, '3' }, botright = {{ 'ctrl', 'alt', 'cmd' }, '4' }, maximum = {{ 'ctrl', 'alt', 'cmd' }, 'm' }, toggleFullScreen = {{ 'ctrl', 'alt', 'cmd' }, 'f' }, toggleZoom = {{ 'ctrl', 'alt', 'cmd' }, 'z' }, center = {{ 'ctrl', 'alt', 'cmd' }, 'c' }, nextScreen = {{ 'ctrl', 'alt', 'cmd' }, 'n' }, previousScreen = {{ 'ctrl', 'alt', 'cmd' }, 'p' }, resizeOut = {{ 'ctrl', 'alt', 'cmd' }, '=' }, resizeIn = {{ 'ctrl', 'alt', 'cmd' }, '-' } }
You can pass the part of the key mappings that you want to override to the
bindHotkeys()function. For example:
spoon.ShiftIt:bindHotkeys({ upleft = {{ 'ctrl', 'alt', 'cmd' }, 'q' }, upright = {{ 'ctrl', 'alt', 'cmd' }, 'w' }, });
If you use SpoonInstall:
https://github.com/peterklijn/hammerspoon-shiftit.
~/.hammerspoon/init.lua```lua hs.loadSpoon("SpoonInstall")
spoon.SpoonInstall.repos.ShiftIt = { url = "https://github.com/peterklijn/hammerspoon-shiftit", desc = "ShiftIt spoon repository", branch = "master", }
spoon.SpoonInstall:andUse("ShiftIt", { repo = "ShiftIt" }) ```