I frequently use Ctrl+Super+Arrow -Keys to move windows around. However, with a multiple monitor set up, the shortcuts only move the windows on the current screen.
**Example of my situation:
I have 3 monitors and I have an instance of Chrome
open in my center monitor.
- When I hit Ctrl+Super+Arrow (left)the window splits to the left half of my center monitor.
- When I repeat, the window does not move.
What I'd like to see instead is that in [2.]
, the window moves to the right half of the left most monitor, and so on
How do I achieve this behaviour?
Best Answer
Move your semi- maximized windows across multiple screens ("aero- snap" alike)
The script below does exactly as you describe. It can be used on any number of screens. The script is optimized for Unity, but can easily be edited to fit other window managers.
It turned out to be a bit more complicated than I thought, since the script should take into account that the user possibly set the launcher to only appear on the leftmost screen (or not). The targeted positions (and targeted window sizes) should be calculated accordingly.
Notes
xdotool
andwmctrl
- commands. Since these commands can have some "characteristic behaviour" in combination with Unity, there is a possiblility minor changes can be useful on your system. I tested it on two (quite different) systems however, working fine on both.The script
How to use
The scrpt needs both
wmctrl
andxdotool
:Copy the script into an empty file, save it as
move_window.py
Test- run the script from a terminal window by (repeatedly) the command:
which should move the window through your screens to the rignt, and:
which should move the window through your screens to the left.
If all works fine, add both commands to shortcut keys: choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the commands to two shortcut keys of your choice.
Important notes
The launcher width is set to
65px
(corresponding to icon size48px
+17px
borders, which is the default). If the set width is different, it should be set correctly in the head of the script, as indicated in the section:In the headsection of the script, there is furthermore a line:
which sets the empty marge at the right side of the moved screen. Change it if you like to another value.