Skip to content

Instantly share code, notes, and snippets.

@joshwnj
Created October 4, 2016 02:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshwnj/042c943e68d748515e79e43e634e1f6a to your computer and use it in GitHub Desktop.
Save joshwnj/042c943e68d748515e79e43e634e1f6a to your computer and use it in GitHub Desktop.
hammerspoon config for window resizing / moving in a grid
local hotkey = require "hs.hotkey"
local grid = require "hs.grid"
grid.MARGINX = 10
grid.MARGINY = 10
grid.GRIDHEIGHT = 3
grid.GRIDWIDTH = 7
local mash = {"cmd", "alt", "ctrl"}
local mashshift = {"cmd", "alt", "ctrl", "shift"}
local slightmash = {"cmd", "ctrl"}
--Move windows
hotkey.bind(mash, 'DOWN', grid.pushWindowDown)
hotkey.bind(mash, 'UP', grid.pushWindowUp)
hotkey.bind(mash, 'LEFT', grid.pushWindowLeft)
hotkey.bind(mash, 'RIGHT', grid.pushWindowRight)
--Move windows slightly
hotkey.bind(slightmash, 'DOWN', grid.pushWindowDown)
hotkey.bind(slightmash, 'UP', grid.pushWindowUp)
hotkey.bind(slightmash, 'LEFT', grid.pushWindowLeft)
hotkey.bind(slightmash, 'RIGHT', grid.pushWindowRight)
--resize windows
hotkey.bind(mashshift, 'UP', grid.resizeWindowShorter)
hotkey.bind(mashshift, 'DOWN', grid.resizeWindowTaller)
hotkey.bind(mashshift, 'RIGHT', grid.resizeWindowWider)
hotkey.bind(mashshift, 'LEFT', grid.resizeWindowThinner)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment