Skip to content

Instantly share code, notes, and snippets.

@gleenn
Created September 7, 2023 17:35
Show Gist options
  • Save gleenn/dce3d35235e7d3e589f3ba6c44c4d338 to your computer and use it in GitHub Desktop.
Save gleenn/dce3d35235e7d3e589f3ba6c44c4d338 to your computer and use it in GitHub Desktop.
the complete init.lua that goes in .hammerspoon to replace shiftit which is not deprecated
mods = { 'ctrl', 'alt', 'cmd' }
units = {
bottom = { x = 0.0, y = 0.5, w = 1.0, h = 0.5 },
left = { x = 0.0, y = 0.0, w = 0.5, h = 1.0 },
right = { x = 0.5, y = 0.0, w = 0.5, h = 1.0 },
top = { x = 0.0, y = 0.0, w = 1.0, h = 0.5 },
}
animationDuration = 0
function createMoveWindow(rect)
return function ()
hs.window.focusedWindow():move(rect, nil, true, animationDuration)
end
end
hs.hotkey.bind(mods, 'down', createMoveWindow(units.bottom))
hs.hotkey.bind(mods, 'left', createMoveWindow(units.left))
hs.hotkey.bind(mods, 'right', createMoveWindow(units.right))
hs.hotkey.bind(mods, 'up', createMoveWindow(units.top))
hs.hotkey.bind(mods, 'm', function()
hs.window.focusedWindow():maximize(animationDuration)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment