Bug 448369 - Keyboard shortcuts ignored after restarting kwin
Summary: Keyboard shortcuts ignored after restarting kwin
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: 5.23.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 449428 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-01-13 14:50 UTC by avalonvales
Modified: 2022-02-09 22:30 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.91
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description avalonvales 2022-01-13 14:50:39 UTC
SUMMARY
Restarting kwin with kwin_x11 --replace (something which I rely on a lot unfortunately) causes all keyboard shortcuts, Alt+tab as well as custom ones, to stop working. 
Switching/closing windows is still possible using the mouse, and shortcuts related to other components of kde function normally (e.g. can launch new instance of app on system tray by clicking it with middle mouse button).
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Restart kwin with kwin_x11 replace
2. Try to switch to another window with Alt+Tab, or close a window with Alt+F4

OBSERVED RESULT
Nothing happens :(

EXPECTED RESULT
Switches to previous window, or window is closed


SOFTWARE/OS VERSIONS
Linux: 5.15.7-arch1-1 (64-bit)
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
error output:
`kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5089:46: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5091:48: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5093:48: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5097:47: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5099:46: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5107:48: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5111:46: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5113:46: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5117:45: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5120:46: this compose sequence is a duplicate of another; skipping line
Module 'org.kde.kwin.decoration' does not contain a module identifier directive - it cannot be protected from external registrations.
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 2637, resource id: 54526091, major code: 18 (ChangeProperty), minor code: 0`
Comment 1 Nate Graham 2022-01-13 21:28:32 UTC
Do in-app keyboard shortcuts still work? Like Ctrl+T in Firefox or Dolphin?
Comment 2 Tiernan Hubble 2022-02-04 02:17:54 UTC
I'm having an identical issue. Same symptoms as the original report: Alt+F4 to close a window and Alt+Tab to switch windows no longer work. I've verified that these keybindings are set in the Shortcuts KCM - I've even tried disabling Alt+F4, saving, and re-enabling it; no luck. This happens whether I do "kwin_x11 --replace" or kill and restart kwin_x11 manually.

I did notice that a couple of applications still work with Alt+F4: Ungoogled Chromium and QMPlay2 are the only 2 I've found. Maybe these 2 applications have this functionality built in? I've tried a few others (Firefox, Thunderbird, even KDE apps like Dolphin and System Settings) and they all fail to close windows with Alt+F4. Alt+Tab never works no matter what application is active.

Unfortunately I can't remember when it started, but it was quite recently (I only use kwin keyboard shortcuts occasionally).

SOFTWARE/OS VERSIONS
Gentoo, kernel 5.15.5, x86_64
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2, with KDE patches up to https://invent.kde.org/qt/qt/qtbase/-/commit/f4ac0b55c37f2b594ffbe639db43dac365825c7c
Comment 3 Nate Graham 2022-02-04 02:53:33 UTC
On Wayland, I've been seeing *some* KWin shortcuts break a lot, most notably Meta+W for Overview and Meta+plus and Meta+minus for zoom in and zoom out. But Alt+Tab always works for me.
Comment 4 Tiernan Hubble 2022-02-04 03:16:08 UTC
Actually on a hunch, right after I posted my last comment, I tried killing kwin_x11 and then launching it with "dbus-launch kwin_x11", and that fixed it. So it looks like it just got out of sync with the kglobalaccel dbus service. (I might have updated kwin and/or frameworks at some point, I don't remember exactly when it started).

This did break latte-dock's ability to launch the Present Windows effect, and restarting latte with dbus-launch didn't work either, only a full session restart got everything working again. That's probably outside the scope of this issue though.

After I got everything working again, I did "kwin_x11 --replace" without dbus-launch, and everything's still working fine - so I'm not sure my issue was the same as the original report. Maybe worth a try for the original reporter though, if they're still having the issue?
Comment 5 Vlad Zahorodnii 2022-02-04 09:52:31 UTC
It looks like it was broken with 25e84f3f6ac54097d9c021705dc18b187352fa02 in kglobalaccel
Comment 6 Bug Janitor Service 2022-02-04 10:44:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kglobalaccel/-/merge_requests/39
Comment 7 Vlad Zahorodnii 2022-02-04 12:14:05 UTC
Git commit f31f4976cd8d17f6b890f7617b364cf2ee6ea2ce by Vlad Zahorodnii.
Committed on 04/02/2022 at 12:12.
Pushed by vladz into branch 'master'.

Fix action registration and unregistration order

It appears like the order between QDBus::NoBlock and QDBus::Block calls
is undefined. If a blocking call is made after a few non-block calls,
those non-block calls can arrive at the destination after the blocking
call.

This is the root cause of some global shortcuts not working in kwin.
When restarting compositing, the effects will release and register
shortcuts but kglobalacceld receives setInactive() and doRegister()
requests in the opposite expected order.

kglobalaccel either should use QDBus::NoBlock for all requests or none.

M  +2    -2    src/kglobalaccel.cpp

https://invent.kde.org/frameworks/kglobalaccel/commit/f31f4976cd8d17f6b890f7617b364cf2ee6ea2ce
Comment 8 Vlad Zahorodnii 2022-02-09 22:30:27 UTC
*** Bug 449428 has been marked as a duplicate of this bug. ***