Enjoying multi-monitor setup at home and work, but wondering how to move focus between individual monitors (ie "screens") without a mouse?
Keyboards shortcuts are excellent for switching virtual desktops, and I looked at various options in ccsm
but nothing came to mind.
I also look at other questions such as focus switch between separate X screens or links to dualscreenmouseutils and switchscreen but all of these seem to be concerned with separate screens per xorg.conf
. These days, Unity "just works" with multiple monitors (via display port) so it is a bit of an embarrassment of riches.
But any hints how to navigate multiple (physical) screens within a single (virtual) Unity display would be very welcome.
Best Answer
Toggle between screens and (optionally) set focus on the (full screen) window
The script below will toggle (and "focus") between the left and the right screen if both screens are more or less center- or top aligned, and more or less of the same vertical resolution.
I assume in practically all situations of a left/right screen setup it will work.
The script
How to use
The script need
xdotool
to be installed (!)Copy the script into an empty file, save it as
toggle_screenloc.py
Test-run it by the command:
If all works fine, add it to a shortcut key: Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:
What it does exactly
If the script is run, it:
xrandr
command.it sees if the mouse is on the left- or right screen, by checking the (
xdotool
) command:If the mouse pointer is located on the left screen:
If the mouse pointer is on the right screen:
Subsequently, the mouse clicks a single time to set focus on the (possible) full screen application (optional).