23

I recently switched to Ubuntu 22.04, and encountered this issue when switching workspaces:

I open a window (e.g. a text editor) on a given workspace, and interact with the window (e.g. write “test”). Then I switch to another workspace, using the default keyboard shortcut. When I switch back to the original workspace and want to continue typing, the text editor window is somehow not active, and a “Find files on Desktop” pop-up window opens.

I observe this problem not only with text editors, but also terminals, browser, etc.

Any ideas how to avoid this?

Example screen recording

ingo-m
  • 361
  • I cannot reproduce this issue. Please correct your title to read Ubuntu 22.04 instead of Ubuntu 22. – vanadium May 08 '22 at 09:51
  • 3
    I have the same issue and it's really annoying... When switching workspace, focus is on the desktop instead of on the active window like it should. Examples: 1/ Nautilus open on one workspace and enter that workspace from another one, type Ctrl+L. The expected behavior is to get me to the search bar of Nautilus, but instead a small popup opens and offers to search files on the desktop. 2/ The same happens here on this forum with Firefox: focus is lost when switching workspace. Expected behavior is, when switching workspace, to keep focus where it last was. I am looking for a solution and will – Ben May 12 '22 at 07:51
  • 1
    On my Kubuntu 22.04 I also loose focus when switching virtual desktops. But interestingly only sometimes. – mr.wolle Feb 05 '24 at 11:29
  • I cannot reproduce the issue anymore (on a fresh Ubuntu 22.04 install with X11 windowing system, GNOME 42.9, and proprietary nvidia drivers 535.154.05). I don't know why. Was this fixed in a GNOME update? – ingo-m Feb 07 '24 at 10:41

3 Answers3

32

I ran into the same problem. I was able to get it working again on X11 by disabling the Desktop Icons NG extension by typing the following in a terminal:

gnome-extensions disable ding@rastersoft.com

  • 9
    In my case this bug appeared after upgrade from 22.10 to 23.04 and disabling this extension helped. Thanks! – Lisio Apr 25 '23 at 22:18
  • 1
    It helped, thanks a lot! But disabling the desktop icons extension disabled desktop icons, who would know. I guess we are living icons free for now, haha. – Kirill Fedyanin Apr 27 '23 at 07:41
  • It’s probably a different root-cause than for the OP, but definitely my solution for 23.04 as well. A shame we cannot set tags on answers, too. – MPi Apr 28 '23 at 13:59
  • 2
    FINALLY!!! This has been driving me crazy for days now! Thanks for this pointer! :) – tftd May 05 '23 at 00:33
  • 1
    I have the same issue. Disabling this extension fixes the focus issue at the unfortunate cost of hiding my desktop icons. Running Ubuntu 23.04 upgraded from 22.10. – bmurphy1976 Jun 15 '23 at 14:03
  • I don't know how did you find out but you deserve at least a bottle of Hennessy. xD – bteo Sep 21 '23 at 01:11
  • Solved for me. Ubuntu 23.04. Desktop icons were hidden. – pinei Oct 29 '23 at 22:19
3

The bug causing active windows to de-focus when switching workspaces has been described here:

Apparently this only happens when using Xorg. I was using Xorg; Wayland was disabled because of an issue with nvidia drivers described here: Can't use Wayland with Nvidia 510 drivers on Ubuntu 22.04 LTS

I was able to enable Wayland by setting WaylandEnable=true in /etc/gdm3/custom.conf, in combination with the hack described here: https://askubuntu.com/a/1403916/1593752

With Wayland enabled, the problem with windows losing focus is gone. But I do have serious graphics glitches now (flickering, windows briefly disappearing).

ingo-m
  • 361
0

Well, after researching the problem multiple times it happens that the gnome/ding contributors are not going to solve the problem soon, but there is an elegant solution that works quite well.

Installing this Gnome extension solved the problem for me, without needing to disable the DING extension: https://extensions.gnome.org/extension/4688/focus-follows-workspace/?c=154468 https://github.com/christopher-l/focus-follows-workspace

I hope it helps!

bteo
  • 280
  • 1
  • 5
  • 11