8

I generally use a quick flick of the mouse to switch focus between windows on different monitors. I generally keep the same application on a particular monitor so know where it 'lives'. I usually use the Keyboard Alt+Tab to cycle between windows that are covered by others, so from that POV it's quite confusing when Alt+Tab causes windows on the other monitor to the one I'm looking at get cycled.

Is there any way to limit the list of Alt+Tab windows only to the current monitor that has focus?

I'm on GNOME, not Compiz, on Ubuntu 19.04

EoghanM
  • 5,125

2 Answers2

2

Short answer

This snippet was written on request for Ubuntu Budgie, but should work on anything but Wayland. It switches between windows on current workspace & monitor, and, depending on the possible argument, either between all windows or between windows of the active application.
It doesn't show any animations though, it just cycles through windows.

Setup instructions are in the link.

Disclaimer: I am the author

Jacob Vlijm
  • 83,767
  • This is great, thanks and works as described! I'm gonna try it out for a while before accepting; it feels weird currently as I'm definitely accustomed to the window preview functionality. BTW to set an ALT-TAB shortcut in Gnome Settings you first have to remove ALT-TAB from the current shortcut (otherwise it just executes an alt-tab!) – EoghanM Jul 19 '19 at 08:42
  • I'm getting the following warning on the console FYI
      return Gdk.get_default_root_window().get_pointer()[1:3]
    
    – EoghanM Jul 19 '19 at 08:43
  • Hmmm, actually I'm realising that this behaviour is very different from the previous as it cycles through all windows. The basic 'quick' usage of Alt-Tab is used to toggle between 2 windows i.e. between current window and last opened window. The default version with previews only enters the 'cycle' mode when you keep ALT held down (and further allows you to go backwards if you hold down SHIFT). – EoghanM Jul 19 '19 at 08:49
  • Ah, right I can easily make it switch according window stack (previous active first) would that help? – Jacob Vlijm Jul 19 '19 at 08:56
  • I actually think the whole ALT-TAB paradigm is broken. It was a blind inheritance from MSWindows and I've got a feeling it violates some core principals of UI design! I've tried something else; I've bound your script to ALT+2 and made another version of your script which goes in the reverse direction (wins[1] - 1 instead of wins[1] + 1) which I've bound to ALT+1. So now I have more direct control of the cycling back or forward. Gonna try this out for a while. – EoghanM Jul 19 '19 at 09:13
  • Probably the best thing would be to also detect for a SHIFT key being pressed to cycle in the reverse direction, however I don't know if that's possible? – EoghanM Jul 19 '19 at 09:13
2

You can use either the Current screen only on window switcher extension or the Alt-Tab for Dual Monitor extension. They both work similarly and cycle windows on the current monitor (the one with the mouse) only.

Although it is mentioned in the GNOME Shell extensions webpage that they support GNOME Shell versions up to 3.32, they both work fine for versions at least up to 3.36 (that's what I've tested).

Also see this question for how to install GNOME Shell extensions: How do I install and manage GNOME Shell extensions?