https://bugs.kde.org/show_bug.cgi?id=526530

            Bug ID: 526530
           Summary: Nested kwin_wayland deactivates the parent session's
                    global shortcuts when it exits; --no-global-shortcuts
                    does not prevent it
    Classification: Plasma
           Product: kwin
      Version First master
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: platform-wayland-nested
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

SUMMARY

A nested kwin_wayland running inside a live Plasma Wayland session kills all
global
shortcuts of the *outer* session when it exits: Alt+Tab, Meta+W, keyboard
layout switch.
--no-global-shortcuts does not prevent it, and nothing is logged.

Both instances register the same hardcoded component names ("kwin" and "KDE
Keyboard
Layout Switcher"), and kglobalacceld keys components by name with no record of
which
client registered what. So when the nested instance is torn down,
KGlobalAccel's client
library sends setInactive for every action it believes it owns, and the daemon
deactivates the shortcuts the live session is still using.

STEPS TO REPRODUCE

In a Plasma Wayland session:

1. qdbus6 org.kde.kglobalaccel /component/kwin
org.kde.kglobalaccel.Component.isActive
   -> true
2. kwin_wayland --socket=nested --width 800 --height 600 --no-lockscreen
--no-global-shortcuts
   Alt+Tab still works while it runs. Let it exit.
3. Same call as in step 1 -> false. Same for
/component/KDE_Keyboard_Layout_Switcher.

OBSERVED RESULT

Alt+Tab and the other "kwin" shortcuts are dead. The key sequences are
unregistered in
the daemon, so no globalShortcutPressed signal is emitted at all. Other
components
(plasmashell) are unaffected. Reassigning the shortcut in System Settings does
not
restore it (the KCM does not set SetPresent), and neither does
KWin.reconfigure;
restarting KWin, or re-sending the same keys with SetPresent, does.

EXPECTED RESULT

A nested instance exiting leaves the outer session's shortcuts alone. With
--no-global-shortcuts I would expect it not to talk to kglobalacceld at all.

SOFTWARE/OS VERSIONS

KDE Linux (image 202609290254, built from master), Plasma/KWin 6.8.80 on
Wayland,
KF6GlobalAccel 6.31.0, Qt 6.11.2, kernel 7.2.7 (64-bit).

ADDITIONAL INFORMATION

Pointers, against master as of 2026-10-02:

- --no-global-shortcuts (kwin src/main_wayland.cpp:622 -> src/main.h:220) is
read in two
  places only, both input filters: src/input.cpp:3179 and :3195. Registration
is
  unconditional: src/workspace.cpp:187 -> src/useractions.cpp:800, where
componentName is
  the literal "kwin"; same for src/keyboard_layout.cpp:45-55.
- kglobalaccel src/kglobalaccel.cpp:232: QAction::destroyed ->
remove(SetInactive). The
  comment there assumes apps and kglobalaccel are torn down together.
- kglobalacceld src/kglobalacceld.cpp:438 -> globalshortcut.cpp:85, :195
unregisters the
  keys. Lookups are by name (globalshortcutsregistry.cpp:300), doRegister is
idempotent
  with no reference counting, and the daemon stores nothing about the sender,
so it cannot
  tell "the owner died" from "another process sent setInactive".

Either side could fix it: KWin not registering when !supportsGlobalShortcuts()
(that would
also cover Workspace::disableGlobalShortcutsForClient, src/workspace.cpp:1795,
which calls
blockGlobalShortcuts on the outer daemon), or kglobalacceld tracking the
registering
connection and ignoring setInactive from non-owners.

My case is a nested KWin used as a throwaway host for a browser running as
another user;
I worked around it with an unreachable DBUS_SESSION_BUS_ADDRESS.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to