Public bug reported:

When Desktop Icons NG ([email protected], shipped in gnome-shell-
ubuntu-extensions) is enabled, switching workspaces can immediately send
the user to a different workspace. This happens whenever a window on
another workspace has _NET_WM_STATE_DEMANDS_ATTENTION set. The user ends
up on the workspace of the window that demands attention, and that
window takes the focus.

Environment:
- Ubuntu 26.04.1 LTS, Wayland session
- gnome-shell 50.1-0ubuntu1.4, mutter-common 50.1-0ubuntu2.5
- gnome-shell-ubuntu-extensions 50.26.04.8ubuntu

Steps to reproduce:
1. Run an XWayland chat app (here WeChat for Linux 4.1.1.8) on workspace 1. 
Keep working on workspace 3.
2. Wait until the app receives a message. It sets 
_NET_WM_STATE_DEMANDS_ATTENTION on its window, and its dock icon starts 
wiggling.
3. Switch to workspace 4, using the touchpad gesture or a keyboard shortcut.

Expected result:
Workspace 4 is shown, and its most recently used window gets the focus.

Actual result:
Workspace 4 is shown for about 10 ms. The shell then switches to workspace 1 
and focuses the window that demands attention. Every time this happens, it 
interrupts what the user is doing.

With DING disabled (Settings > Ubuntu Desktop > Desktop Icons off), the
problem does not occur.

Analysis:
In 
/usr/share/gnome-shell/extensions/[email protected]/emulateX11WindowType.js, 
DING connects to 'switch-workspace' (around line 318) and calls 
_refreshWindows(true). In an idle callback, that function then activates the 
first window returned by:

    global.display.get_tab_list(Meta.TabList.NORMAL_ALL,
                                global.workspace_manager.get_active_workspace())

    ...
    Main.activateWindow(window);   // "activate the top-most window"

When a workspace is passed, meta_display_get_tab_list() in mutter
(src/core/display.c) also adds windows from OTHER workspaces that have
wm_state_demands_attention, using g_list_prepend. That window can
therefore become the first entry in the list. Main.activateWindow() sees
that the window is on a different workspace and calls
workspace.activate_with_focus(), which switches to that workspace.

Mutter debug log (FOCUS/STACK/WORKSPACES/X11 topics) for one occurrence.
Window titles are shortened:

    09:46:21.323 X11: Request to change _NET_WM_STATE action 1 atom1: 
_NET_WM_STATE_DEMANDS_ATTENTION   <- chat app (window on workspace index 0)
    09:46:22.274 WORKSPACES: Activating workspace 3                             
                         <- user switches
    09:46:22.275 FOCUS: Focusing workspace MRU window W29 (IDE window)          
                          <- correct so far
    09:46:22.287 WORKSPACES: Activating workspace 0                             
                         <- DING idle callback
    09:46:22.291 FOCUS: _NET_ACTIVE_WINDOW message sent for 0x1a00011 (WeChat) 
at time 0 by client type 2.
    09:46:22.292 FOCUS: Focusing window 0x1a00011 (WeChat) due to activation

"client type 2" (pager) with "time 0" matches Main.activateWindow()
being called from an idle callback.

Upstream status:
Upstream removed this whole "activate the top-most window" block in the GTK4 
port, commit aa27c4a5170a6f738f23c20c0496fb459c1be0c4 
(https://gitlab.com/rastersoft/desktop-icons-ng/-/commit/aa27c4a5170a6f738f23c20c0496fb459c1be0c4).
 The 26.10 package gnome-shell-ubuntu-extensions 51.26.10.6ubuntu contains the 
new code and is not affected. 26.04 LTS still ships the old code.

Suggested minimal fix for 26.04 (SRU):
In _refreshWindows(), skip windows that are not on the active workspace before 
calling Main.activateWindow(), for example:

    const activeWs = global.workspace_manager.get_active_workspace();
    for (let window of windows) {
        if (!window.located_on_workspace(activeWs))
            continue;
        ...

Possibly related:
- LP: #1969598 (DING steals keyboard focus after workspace switch)
- https://gitlab.com/rastersoft/desktop-icons-ng/-/issues/235
- https://gitlab.com/rastersoft/desktop-icons-ng/-/issues/106
- https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7517 (workspace changes 
on terminal bell; not verified whether DING was involved)

ProblemType: Bug
DistroRelease: Ubuntu 26.04
Package: gnome-shell-ubuntu-extensions 50.26.04.8ubuntu
ProcVersionSignature: Ubuntu 7.0.0-38.38-generic 7.0.14
Uname: Linux 7.0.0-38-generic x86_64
ApportVersion: 2.34.1-0ubuntu0.1
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Wed Oct 28 10:46:09 2026
InstallationDate: Installed on 2026-07-19 (101 days ago)
InstallationMedia: Ubuntu 26.04 "Resolute Raccoon" - Release amd64 (20260423.1)
PackageArchitecture: all
ProcEnviron:
 LANG=zh_CN.UTF-8
 PATH=(custom, no user)
 SHELL=/usr/bin/zsh
 TERM=xterm-ghostty
 XDG_RUNTIME_DIR=<set>
SourcePackage: gnome-shell-ubuntu-extensions
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: gnome-shell-ubuntu-extensions (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug resolute wayland-session

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2172357

Title:
  DING switches to another workspace after every workspace switch when a
  window on that workspace demands attention

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-shell-ubuntu-extensions/+bug/2172357/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to