I have 2 displays on my PC - an IDE is open fullscreen in one display and Firefox is open fullscreen in another display.
Since I mostly use the keyboard, it's annoying to have to grab the mouse to switch the focus to Firefox and back to the IDE all the time.
Is there a shortcut I could use to switch the focus to "largest window" on display 2 if focus is somewhere in display 1 and vice versa?
Today I got an upvote for this question, so I'm posting my solution I've been all the time using for more than a year and am quite happy with.
Step 1: make bash script (e.g. write it to
~/swap.sh
and make it executable) to set focus to a window that is in the middle of the other display:Step 2: add a keyboard shortcut to call this script, I put mine to
Super-Tab
Step 3: use shortcut to switch displays like a boss
this repository may help you
https://github.com/Eitol/screen_focus_changer
You place the focus_changer.py left script in a fixed place (/ opt for example) And then add the keybinding / shortcut / hotkey in your settings
python3 /opt/focus_changer.py left # Focus to left
python3 /opt/focus_changer.py right # Focus to right
You can use AltTab to switch between windows.
AltTab also remebers which two window you last switched between. If you switch to one window (navigate with the arrow keys), then switch back, just pressing AltTab will allow you to jump between them, without any further navigation.
If you like me googled "keyboard shortcut switch monitors linux" and found this link... the above answers are not the easiest answers, if you are on a GNOME-based environment.
The keyboard shortcut Shift + Super + ? or Shift + Super + ? will switch to the monitor in that direction from the currently focused program.