Skip to content

Instantly share code, notes, and snippets.

@jim80net
Created April 30, 2021 19:09
Show Gist options
  • Select an option

  • Save jim80net/d9976c0ec19e2a8328b45f26449fa2a1 to your computer and use it in GitHub Desktop.

Select an option

Save jim80net/d9976c0ec19e2a8328b45f26449fa2a1 to your computer and use it in GitHub Desktop.
My ~/.hammerspoon/init.lua
hs.window.animationDuration = 0
units = {
right30 = { x = 0.70, y = 0.00, w = 0.30, h = 1.00 },
right50 = { x = 0.50, y = 0.00, w = 0.50, 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 },
left50 = { x = 0.00, y = 0.00, w = 0.50, 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 },
upright50 = { x = 0.50, y = 0.00, w = 0.50, h = 0.50 },
botright50 = { x = 0.50, y = 0.50, w = 0.50, h = 0.50 },
upleft50 = { x = 0.00, y = 0.00, w = 0.50, h = 0.50 },
botleft50 = { x = 0.00, y = 0.50, w = 0.50, h = 0.50 },
top33 = { x = 0.00, y = 0.00, w = 1.00, h = 0.33 },
mid33 = { x = 0.00, y = 0.33, w = 1.00, h = 0.33 },
bot33 = { x = 0.00, y = 0.66, w = 1.00, h = 0.34 },
maximum = { x = 0.00, y = 0.00, w = 1.00, h = 1.00 }
}
mash = { 'alt', '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, '1', function() hs.window.focusedWindow():move(units.upleft50, nil, true) end)
hs.hotkey.bind(mash, '2', function() hs.window.focusedWindow():move(units.upright50, nil, true) end)
hs.hotkey.bind(mash, '3', function() hs.window.focusedWindow():move(units.botleft50, nil, true) end)
hs.hotkey.bind(mash, "4", function() hs.window.focusedWindow():move(units.botright50, nil, true) end)
hs.hotkey.bind(mash, 'm', function() hs.window.focusedWindow():move(units.maximum, nil, true) end)
hs.hotkey.bind(mash, '5', function() hs.window.focusedWindow():move(units.top33, nil, true) end)
hs.hotkey.bind(mash, '6', function() hs.window.focusedWindow():move(units.mid33, nil, true) end)
hs.hotkey.bind(mash, '7', function() hs.window.focusedWindow():move(units.bot33, nil, true) end)
hs.hotkey.bind(mash, 'up', function() hs.window.focusedWindow():move(units.top50, nil, true) end)
hs.hotkey.bind(mash, 'left', function() hs.window.focusedWindow():move(units.left50, nil, true) end)
hs.hotkey.bind(mash, 'down', function() hs.window.focusedWindow():move(units.bot50, nil, true) end)
hs.hotkey.bind(mash, 'right', function() hs.window.focusedWindow():move(units.right50, nil, true) end)
hs.hotkey.bind(mash, 'm', function() hs.window.focusedWindow():moveOneScreenEast(false, true) end)
hs.hotkey.bind(mash, 'n', function() hs.window.focusedWindow():moveOneScreenWest(false, true) end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment