I’ve been using Ubuntu on my laptop for the past few weeks and have found a few handy tips for flinging windows around. Here are a few keyboard shortcuts as well as some custom little commands that use wmctrl to do some custom window sizes and locations.
My keyboard does not have a number pad. I’m calling the “Windows” key the “super” key. These shortcuts come with Unity:
Move window to left half of screen: ctrl+super+left-arrow
Move window to right half of screen: ctrl+super+right-arrow
I also wanted to be able to fill about 75% of my screen with a window – not just 50% so I made a couple quick custom keyboard shortcuts. Since wmctrl will not move maximized windows, I made a couple short little scripts to remove the maximized attributes from the windows before trying to move the windows.
#!/bin/bash
wmctrl -r :ACTIVE: -b remove,maximized_vert
wmctrl -r :ACTIVE: -b remove,maximized_horiz
wmctrl -r :ACTIVE: -e 0,0,0,1300,1010
wmctrl -r :ACTIVE: -b add,maximized_vert
Save that file somewhere like
/home/yourname/bin/win-left.sh
and make sure it is executable
chmod a+x /home/yourname/bin/win-left.sh
Now you can make a keyboard shortcut for it in System Settings -> Keyboard -> Shortcuts -> Custom Shortcuts.
Thank you so much for your post Lee, i am using Ubuntu for past some time and these commands are really useful for me.