After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 653085 - focus change issues on workspace change with multiple monitors
focus change issues on workspace change with multiple monitors
Status: RESOLVED OBSOLETE
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 780417 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-06-21 08:57 UTC by Alexander Larsson
Modified: 2021-07-05 14:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alexander Larsson 2011-06-21 08:57:33 UTC
I regularly get confused by the workspace focus behaviour in the multi monitor case. I have a setup where xchat is always running on the non-primary monitor, then I keep various work windows on different workspaces, often maximized.

The way focus currently work is that we remember the focused window for every workspace and when we switch to a workspace we focus the rembered window. However, sometimes the focused window is on the non-primary monitor, and this is where things get confused.

For instance, lets say xchat (on the non-primary window) is *not* focused, and you're looking at a fullscreen focused window on the primary monitor, then you switch to a workspace with a maximized firefox. If, when you last visited that workspace xchat was the focused window then xchat will get the focus after the switch (even if it was previously visible but not focused). Then I commonly assume firefox is focused (because I was just looking at the primary monitor, and unfocused maximized windows are not obvious) press ctrl-L and marvel at the cleared backlog in my xchat buffer.

I'm not sure what the best behaviour would be though, maybe if the focus is on a non-primary-monitor (or sticky) window and we should keep the focus on workspace switch, but if the focused window was lost due to the workspace switch we should always make a window on the primary monitor have the focus.
Comment 1 Alexander Larsson 2011-06-21 09:52:03 UTC
Also, its kinda confusing that the stacking order is different on the non-primary monitors on different workspaces.
Comment 2 Mourad De Clerck 2013-06-23 12:11:09 UTC
This is still an issue.

IMHO, the best thing to do would be to remember the focused window for every workspace _and_ for every monitor.

When we change workspace, we'd focus the window on the new workspace but on the same monitor.

So the goal is to never change focus away from the current monitor when we change workspace or when we close a window (!) unless the user focused on it manually, or we run out of windows.

I'd argue even alt-tab behaviour would favour sticking to the same monitor, but I can see people disagreeing with me here.
Comment 3 Gustavo Noronha (kov) 2013-08-15 16:50:29 UTC
This is the reason I keep my laptop's screen off instead of using it as I wish I could. This unexpected focus change made me type important passwords on IRC channels way too many times (meaning 1), and it really makes the whole experience suck. I think windows in the fixed screen should only be focused by explicit user action.
Comment 4 Andres Gomez 2013-08-21 12:45:51 UTC
This is, indeed, quite annoying.

Another thing is that, using "exposé" and clicking with the mouse on a window in a different Workspace than the initial, doesn't either give the focus to the chosen windows.

The example with XChat applies also here: XChat gets the focus in the non-primary monitor rather than the clicked window.
Comment 5 Maxim Britov 2014-12-17 07:53:03 UTC
+1 angry user

and why it still UNCONFIRMED?
Comment 6 hitori.gm 2015-02-11 10:42:13 UTC
I quite often have fullscreen window on the secondary monitor, and when I switch between workspaces on the primary monitor fullscreen window always steals focus.
Another annoying thing is flickering of a fullscreen winow on the secondary monitor when I open drop down menus on the primary monitor. I did notice this on mpv and virtualbox.
Comment 7 Joakim Soderlund 2015-06-03 09:32:29 UTC
I'm having the same issue on GNOME 3.14.
Comment 8 jamesrstocker@gmail.com 2015-06-03 09:41:40 UTC
I'm using gnome-shell-3.16.2-1 from the fedora (22) repos, and I notice (almost) the same behaviour, I also had the same issue when using F21.

When I switch workspaces on my laptop screen (I only have workspaces set up on my main screen, the second screen has only one workspace) the focus always goes to the second screen, I keep a VirtualBox VM on that screen (with capture all key presses disabled) and when I switch to another workspace, no matter what window had focus the last time I was on that workspace last the focus ALWAYS goes to my second screen. I've gotten used to the issue, but it is annoying that every time I want to switch workspaces I then have to click or alt-tab to the right window. I've also tested that this happens with other windows, so I placed chrome over on the second screen, without making it full screen, changed workspace, ctrl-n creates a new tab in chrome on the second screen.

I agree with everything that Mourad De Clerck mentioned in comment 2, but I am not so worried about alt-tab behaviour being tied to the window I am currently on, personally I rarely use alt-tab to select what's running in my second screen, so either way is fine. But an option to allow this might be a good idea!
Comment 9 Baptiste Clavié 2016-06-18 21:18:45 UTC
I'm also having this issue, and it's becomming kinda annoying, and it's the same as jamesrstocker.

I have a laptop with GNOME Shell 3.20.2 on an Arch distribution, with a pinned window (always on visible space). If I switch workspace (let's say from a terminal to a Chrome, on space 1), the focus is _always_ on the window I put the option on, and same thing whenever I switch back to workspace 2.

I don't want to set the the focus mode on mouse or sloppy (I don't want to switch focus wherever I put my mouse on...), as suggested in a stackoverflow question (http://askubuntu.com/questions/640805/gnome-shell-multi-desktop-changes-focus-to-other-screen)
Comment 10 Baptiste Clavié 2016-06-18 21:19:31 UTC
I'm also having this issue, and it's becomming kinda annoying, and it's the same as jamesrstocker.

I have a laptop with GNOME Shell 3.20.2 on an Arch distribution, with a pinned window (always on visible space). If I switch workspace (let's say from a terminal to a Chrome, on space 1), the focus is _always_ on the window I put the option on, and same thing whenever I switch back to workspace 2.

I don't want to set the the focus mode on mouse or sloppy (I don't want to switch focus wherever I put my mouse on...), as suggested in a stackoverflow question (http://askubuntu.com/questions/640805/gnome-shell-multi-desktop-changes-focus-to-other-screen)
Comment 11 Florian Müllner 2017-03-22 21:39:08 UTC
*** Bug 780417 has been marked as a duplicate of this bug. ***
Comment 12 jem 2017-07-26 09:48:29 UTC
This bug is very frustrating as it basically makes using a multiple monitor setup unusuable. With the focus randomly switching to the secondary montior, it is easy to send alt+F4 or other shortcuts that will reak havok in the window which has stolen focus.
Comment 13 GNOME Infrastructure Team 2021-07-05 14:36:34 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of  gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/

Thank you for your understanding and your help.