Skip to content

Instantly share code, notes, and snippets.

@eckelon
Last active July 11, 2019 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eckelon/df0c7bdcccbf4eca8ace2b7d020eb74b to your computer and use it in GitHub Desktop.
Save eckelon/df0c7bdcccbf4eca8ace2b7d020eb74b to your computer and use it in GitHub Desktop.
hammerspoon script to emulate shiftIt behaviour
hs.window.animationDuration = 0
units = {
r30 = { x = 0.700, y = 0.000, w = 0.300, h = 1.000 },
r50 = { x = 0.500, y = 0.000, w = 0.500, h = 1.000 },
r70 = { x = 0.300, y = 0.000, w = 0.700, h = 1.000 },
l30 = { x = 0.000, y = 0.000, w = 0.300, h = 1.000 },
l50 = { x = 0.000, y = 0.000, w = 0.500, h = 1.000 },
l70 = { x = 0.000, y = 0.000, w = 0.700, h = 1.000 },
top50 = { x = 0.000, y = 0.000, w = 1.000, h = 0.500 },
bot50 = { x = 0.000, y = 0.500, w = 1.000, h = 0.500 },
max = { x = 0.025, y = 0.025, w = 0.950, h = 0.950 },
center = { x = 0.125, y = 0.125, w = 0.750, h = 0.750 }
}
mash = { 'ctrl', 'alt', 'cmd' }
hs.hotkey.bind(mash, 'right', function() hs.window.focusedWindow():move(units.r50, nil, true) end)
hs.hotkey.bind(mash, 'left', function() hs.window.focusedWindow():move(units.l50, nil, true) end)
hs.hotkey.bind(mash, 'up', function() hs.window.focusedWindow():move(units.top50, nil, true) end)
hs.hotkey.bind(mash, 'down', function() hs.window.focusedWindow():move(units.bot50, nil, true) end)
hs.hotkey.bind(mash, 'l', function() hs.window.focusedWindow():move(units.r30, nil, true) end)
hs.hotkey.bind(mash, 'h', function() hs.window.focusedWindow():move(units.l70, nil, true) end)
hs.hotkey.bind(mash, 'm', function() hs.window.focusedWindow():move(units.max, nil, true) end)
hs.hotkey.bind(mash, 'c', function() hs.window.focusedWindow():move(units.center, nil, true) end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment