yabai and skhd
yabai
yabai is a window management utility that is designed to work as an extension to the built-in window manager of macOS.
yabai on github: https://github.com/koekeishiya/yabai
yabai provides a command to move a window to the next screen:
yabai -m window --space next
If you want to move a window to the next screen and also focus the next screen then use:
yabai -m window --space next && yabai -m window --space next
yabai automatically tiles your windows per default. You can configure the layout float
to disable that. To do that add following line to ~/.yabairc
:
yabai -m config layout float
skhd
skhd is a simple hotkey daemon for macOS.
skhd on github: https://github.com/koekeishiya/skhd
Install skhd and add this line to ~/.skhdrc
:
ctrl + cmd + alt - right : yabai -m window --space next
Then you can move a window to another space with the shortcut ctrl
+ cmd
+ alt
+ right arrow
You can further extend that. Following you see how I configured it in ~/.skhdrc
to move windows between spaces:
# move window to next space and focus next space if next space is not last space of display
ctrl + shift + alt - right : [[ $(yabai -m query --spaces --space | jq '.index') != $(yabai -m query --displays --display | jq '.spaces | max') ]] \
&& yabai -m window --space next \
&& yabai -m window --space next