Bug 502812 - Swapping Caps Lock with Esc does not work on Wayland
Summary: Swapping Caps Lock with Esc does not work on Wayland
Status: RESOLVED WORKSFORME
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keyboard (other bugs)
Version First Reported In: 6.3.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-14 22:11 UTC by Björn Lindqvist
Modified: 2025-04-25 01:03 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Screenshot (373.51 KB, image/png)
2025-04-19 16:32 UTC, Björn Lindqvist
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Lindqvist 2025-04-14 22:11:43 UTC
Keyboard -> Key Bindings -> Caps Lock behavior -> Swap Esc and Caps Lock -> Apply

The following is written to the journal:

apr 15 00:01:32 bjourne kwin_wayland_wrapper[235200]: The XKEYBOARD keymap compiler (xkbcomp) reports:
apr 15 00:01:32 bjourne kwin_wayland_wrapper[235200]: > Warning:          Unsupported maximum keycode 708, clipping.
apr 15 00:01:32 bjourne kwin_wayland_wrapper[235200]: >                   X11 cannot support keycodes above 255.
apr 15 00:01:32 bjourne kwin_wayland_wrapper[235200]: > Warning:          Could not resolve keysym XF86RefreshRateToggle
apr 15 00:01:32 bjourne kwin_wayland_wrapper[235200]: > Warning:          Could not resolve keysym XF86Accessibility
apr 15 00:01:32 bjourne kwin_wayland_wrapper[235200]: > Warning:          Could not resolve keysym XF86DoNotDisturb
apr 15 00:01:32 bjourne kwin_wayland_wrapper[235200]: Errors from xkbcomp are not fatal to the X server

I get the same warning when applying most of the key transformations in the list view. "Swap Esc and Caps Lock" causes Esc to behave as Caps Lock, but disables Caps Lock (it does not become Esc).
Comment 1 John Kizer 2025-04-16 01:08:59 UTC
Hi - for what it's worth, the Swap Esc and Caps Lock function works on my Fedora KDE 41 device in a Wayland session, even though those same journal messages appear.

Can you please provide the system information requested in the report template?

(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

Based on that journal message, just curious - does the swap not work in either native Wayland or XWayland applications?

Thanks!
Comment 2 Björn Lindqvist 2025-04-19 16:32:55 UTC
Created attachment 180414 [details]
Screenshot

I was wrong and it does work. Apparently, I had already accidentally allocated the Esc key as shown in the screenshot. Would it be possible to add some smarts to the remapper dialog to detect this scenario? Then it could say "Can't switch Esc and Caps lock because Esc is already mapped to <existing mapping>"?
Comment 3 John Kizer 2025-04-20 16:01:08 UTC
Hmm, so if you have that layout shortcut from the screenshot set to Esc, then when swapped, the physical Caps Lock key doesn't function as Esc and switch the keyboard layout?
Comment 4 Björn Lindqvist 2025-04-21 22:49:23 UTC
Correct. Although as you can see in the screenshot I only have one layout so the Esc binding has no function. I sometimes accidentally assign Esc as I keybinding due to Esc being commonly used for aborting modal dialogs. My configuration is incorrect here, and it would be a nice quality-of-life feature if the UI told me that.
Comment 5 John Kizer 2025-04-22 02:15:00 UTC
I guess the catch is, before you switched Caps Lock and Esc, it sounds like Esc wasn't working anyway since it was bound to a shortcut that did nothing with your device's configuration - is that right?

If you assign Esc as a shortcut that does have a function on your device, unlike the keyboard layout change, is it correctly triggered by using the physical Caps Lock key when the Caps Lock-Esc swap is active?
Comment 6 Björn Lindqvist 2025-04-24 18:44:34 UTC
That appears to work.
Comment 7 John Kizer 2025-04-24 18:56:41 UTC
Great - if I'm understanding correctly, it sounds like there isn't a direct bug with the swap, and that perhaps a warning might not be needed since functional shortcuts also work when swapped?

If I'm misunderstanding that and there's still a bug here, or if it still seems that a shortcut warning in that key bindings dialog would still be needed, feel free to reopen this :-)

Thanks!
Comment 8 Björn Lindqvist 2025-04-24 21:52:16 UTC
Well, you still get these error messages in the journal and they seem ominous.
Comment 9 John Kizer 2025-04-25 01:03:52 UTC
Ah, as I understand it those messages are from XWayland and aren't really indicating a functional problem, it's basically "noise" from that component - https://bugzilla.redhat.com/show_bug.cgi?id=1615700 - so I wouldn't worry too much there :-)