pop-os / shell

Pop!_OS Shell
GNU General Public License v3.0
4.83k stars 261 forks source link

undesired focus changes to second monitor with "Workspaces on Primary Display Only" #1446

Open RafalSkolasinski opened 2 years ago

RafalSkolasinski commented 2 years ago

(1) Issue/Bug Description:

I am working with "Workspaces on Primary Display Only". When moving between workspaces often focus lands on the window on the auxiliary display that is quite undesired.

Having workspace "isolated" more to the given display would give much better user experience.

(2) Steps to reproduce (if you know):

  1. Set workspaces as follows

image

  1. Have two monitors
  2. Create few workspaces and populate with windows (also auxiliary monitor)
  3. Switch between workspaces

Note: the focus may land on the most recently used window (I think that's the case?) so maybe to reproduce one need to focus on window on auxiliary monitor, go to another workspace, do something on main monitor and then change workspace back.

(3) Expected behavior:

Focus stays in within dynamic workspaces having auxiliary monitor not accidentally focused.

(4) Distribution (run cat /etc/os-release):

cat /etc/os-release
NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os

(5) Gnome Shell version:

Whatever comes with above currently,

apt policy gnome-shell
gnome-shell:
  Installed: 42.0-2ubuntu2pop1~1651659368~22.04~0a5841a
  Candidate: 42.1-0ubuntu0.1pop1~1652791059~22.04~477d96d
  Version table:
     42.1-0ubuntu0.1pop1~1652791059~22.04~477d96d 1001
       1001 http://apt.pop-os.org/release jammy/main amd64 Packages
 *** 42.0-2ubuntu2pop1~1651659368~22.04~0a5841a 100
        100 /var/lib/dpkg/status
     42.0-2ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

(6) Pop Shell version (run apt policy pop-shell or provide the latest commit if building locally):

$ apt policy pop-shell
pop-shell:
  Installed: 1.1.0~1652463555~22.04~034fb14
  Candidate: 1.1.0~1652994129~22.04~0358b15
  Version table:
     1.1.0~1652994129~22.04~0358b15 1001
       1001 http://apt.pop-os.org/release jammy/main amd64 Packages
       1001 http://apt.pop-os.org/release jammy/main i386 Packages
 *** 1.1.0~1652463555~22.04~034fb14 100
        100 /var/lib/dpkg/status

(7) Where was Pop Shell installed from:

PopOS

(8) Monitor Setup (2 x 1080p, 4K, Primary(Horizontal), Secondary(Vertical), etc):

Dell XPS 7590 + external Dell monitor

Screen 0: minimum 320 x 200, current 4480 x 1440, maximum 16384 x 16384
eDP-1 connected 1920x1080+2560+360 (normal left inverted right x axis y axis) 344mm x 194mm
   1920x1080     60.00*+  59.97    59.96    59.93  
   1680x1050     59.95    59.88  
   1600x1024     60.17  
   1400x1050     59.98  
   1600x900      59.99    59.94    59.95    59.82  
   1280x1024     60.02  
   1440x900      59.89  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1440x810      60.00    59.97  
   1368x768      59.88    59.85  
   1360x768      59.80    59.96  
   1280x800      59.99    59.97    59.81    59.91  
   1152x864      60.00  
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   960x540       59.96    59.99    59.63    59.82  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   800x512       60.17  
   700x525       59.98  
   800x450       59.95    59.82  
   640x512       60.02  
   720x450       59.89  
   700x450       59.96    59.88  
   640x480       60.00    59.94  
   720x405       59.51    58.99  
   684x384       59.88    59.85  
   680x384       59.80    59.96  
   640x400       59.88    59.98  
   576x432       60.06  
   640x360       59.86    59.83    59.84    59.32  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.63    59.82  
   400x300       60.32    56.34  
   432x243       59.92    59.57  
   320x240       60.05  
   360x202       59.51    59.13  
   320x180       59.84    59.32  
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-1-8 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     59.95*+
   2048x1080     60.00    24.00  
   1920x1080     60.00    50.00    59.94  
   1600x1200     60.00  
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    60.00    59.94  
   720x400       70.08  
DP-1-1 disconnected (normal left inverted right x axis y axis)

(9) Other Installed/Enabled Extensions:

image

(10) Other Notes:

RasmusWL commented 2 years ago

This seems to be a problem with gnome, see https://askubuntu.com/questions/640805/gnome-shell-multi-desktop-changes-focus-to-other-screen (which also has suggested workaround).

FYI: I've also been annoyed by this for a very long time :disappointed:

royrwood commented 2 years ago

I am also experiencing this problem, and it makes me annoyed several times a day!

leviport commented 2 years ago

Try deactivating the "Mouse Cursor Follows Active Window" setting in Extensions > pop-shell settings

karimone commented 2 years ago

Try deactivating the "Mouse Cursor Follows Active Window" setting in Extensions > pop-shell settings

Yes it works. If you are switching to a workspace that has only a window in the external monitor than the focus is in the external monitor and il will affect the switching to another workspace.

leviport commented 2 years ago

If you are switching to a workspace that has only a window in the external monitor than the focus is in the external monitor and il will affect the switching to another workspace.

Sorry, I'm not sure I know what you mean. For me, deactivating the follow behavior has no effect on focused windows only on external displays. The cursor remains where it is before and after switching workspaces, as I would expect.

DrOptix commented 1 year ago

I'm facing the same issue. It annoys me because I really use workspaces on the main screen. The secondary screen is there just to display info that I need across all my workspaces. For example a documentation page or some youtube podcast.

I'm trying to figure out how the focus is stolen by the window on the secondary display when I change the workspace, but no luck until now. Anyway if manage figuring a fix I'll propose a PR, but I don't promise anything as I just start getting used with PopShell code base and typescript as a language.

mikaelhug commented 1 year ago

Came here from a google search and I have this problem in Debian 12 as well, i guess it's gnome shell related. Would be happy if someone found a fix this is super annoying, makes me want to unhook my spare monitor.

lecuek commented 1 year ago

I +1 this, i'd really love to be able to have a setting for that at least. Workarounds are not really much more practical either since it teleports your mouse and even when going on an empty workspace, the mouse still goes on the app open on my second monitor.

hakanErgin commented 1 year ago

image For me it was one of these 'move focus' options

Edit: I didnot realize this was pop-os repo. I am on Ubuntu 18.04 but

RafalSkolasinski commented 1 year ago

@hakanErgin how do you get thi these settings?

xinyazhang commented 1 year ago

As a reference, this is a known bug in gnome-shell https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/742

Tolgon commented 1 year ago

Yeah this is a GNOME issue as I've had it on different computers running GNOME, each using different distros. My workaround for it is using gnome-tweaks application to change the window focus mode to mouse and just keep my mouse on my workspaces monitor.

palewire commented 2 weeks ago

I also have this bug in Ubuntu 24.04