MoveWindows is a "moom" style window mover, originally written by @tmiller that I've adapted over the years.
At it's core, MoveWindows provides a sane set of default vim-style keybindings to move windows around, but you can override anything at any point.
Quickstart, setting the mode to ⌘+⇧+M
:
hs.loadSpoon('MoveWindows')
:start()
:bindHotKeys({toggle = {{"command", "shift"}, "m"}})
If you wish to adjust the bindings and "grid", simply set or extend
MoveWindows.grid before calling MoveWindows:start()
.
MoveWindows = hs.loadSpoon('MoveWindows')
MoveWindows.grid = {
{ key='j', unit=hs.geometry.rect(0, 0.5, 1, 0.5) },
{ key='space', unit=hs.layout.maximized }
}
MoveWindows
:start()
:bindHotKeys({toggle = {{"command", "shift"}, "m"}})
Because MoveWindows is simply a wrapper around hs.hotkey.modal, you can expand it's functionality with other Spoons like Split.spoon, or include your own functionality:
hs.loadSpoon('MoveWindows')
MoveWindows = spoon.MoveWindows
MoveWindows
:start()
:bind('', ',', function()
hs.window.focusedWindow()
:application()
:selectMenuItem("Tile Window to Left of Screen")
MoveWindows:exit()
end)
:bind('', '.', function()
hs.window.focusedWindow()
:application()
:selectMenuItem("Tile Window to Right of Screen")
MoveWindows:exit()
end)
:bind('', 'v', function()
spoon.Split.split()
MoveWindows:exit()
end)
:bindHotKeys({toggle = {{"command", "shift"}, "m"}})
If you want to use Hyper.spoon,
you can just access MoveWindows:toggle()
directly:
Hyper:bind({}, 'm', function() MoveWindows:toggle() end)
MoveWindows also uses hs.window.highlight
if you have it setup. To see the
window you are about to move highlighted, just set
hs.window.highlight.ui.overlay=true
.