This Python script moves the window with focus on an adjacent monitor. It is intendend for window managers lacking this shortcut like XFCE.
movescreen.py <up|down|left|right>
It should be compatible with Python 2.7 and 3.
Copy movescreen.py
in /usr/local/bin
, then:
chmod a+rx /usr/local/bin/movescreen.py
Go to Setting -> Keyboard -> Application shortcuts then add one shortcut for each direction:
Command | Shortcut |
---|---|
/usr/local/bin/movescreen.py left | Ctrl+Super+Left |
/usr/local/bin/movescreen.py right | Ctrl+Super+Right |
python
xrandr
xwininfo
wmctrl
(not installed by default on Ubuntu, trysudo apt-get install wmctrl
)
The script scans for the list of monitors and check their relative positions.
It gather information about the current active window (size, position and flags). It also find on which monitor the window has the biggest area.
Depending on the argument, it moves the window on the selected adjacent monitor (if any) and restore the previously set flags.
A little bit slow the first time it is run.
Only tested with two monitors.
Antoine Calando - 2017 - Public domain.