Here is a generic reproducer that does not need WeChat or any other chat
app.

The script below creates a GTK3 window on XWayland. After a delay, the
window asks to be activated with a stale timestamp. Mutter's focus-
stealing prevention refuses the request and sets
_NET_WM_STATE_DEMANDS_ATTENTION instead, which is what chat apps end up
with when a message arrives.

attention.py:

    #!/usr/bin/env python3
    import os, sys
    os.environ['GDK_BACKEND'] = 'x11'
    import gi
    gi.require_version('Gtk', '3.0')
    from gi.repository import GLib, Gtk

    DELAY = int(sys.argv[1]) if len(sys.argv) > 1 else 5
    win = Gtk.Window(title='attention-test')
    win.set_default_size(300, 100)
    win.add(Gtk.Label(label='demands-attention reproducer'))
    win.connect('destroy', Gtk.main_quit)
    win.show_all()

    def request_activation():
        win.present_with_time(1)   # stale timestamp -> demands attention
        return GLib.SOURCE_REMOVE

    GLib.timeout_add_seconds(DELAY, request_activation)
    Gtk.main()

Steps (Wayland session, at least 4 workspaces, wmctrl installed):
1. Go to workspace 3 and run: python3 attention.py 10 &
2. Move the test window to workspace 1: wmctrl -r attention-test -t 0
3. Stay on workspace 3 and wait until the 10 seconds are over. The window now 
has _NET_WM_STATE_DEMANDS_ATTENTION (check with xprop).
4. Switch to workspace 4, with a keyboard shortcut, a touchpad gesture, or: 
wmctrl -s 3

Result, on the same machine and in the same session:
- DING enabled: _NET_CURRENT_DESKTOP ends up as 0. The shell jumps to workspace 
1 and focuses attention-test.
- DING disabled: _NET_CURRENT_DESKTOP stays 3, which is the expected result.

-- 
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