Bug 483306 - Remapping Caps Lock key to Backspace does not work correctly in XWayland and Electron apps
Summary: Remapping Caps Lock key to Backspace does not work correctly in XWayland and ...
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: input (other bugs)
Version First Reported In: 5.27.8
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2024-03-12 01:32 UTC by Swiftloke
Modified: 2024-03-13 19:08 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Swiftloke 2024-03-12 01:32:36 UTC
SUMMARY
I'm writing this here because I'm frankly clueless as to what could be causing it, and I'm hoping someone here might have enough knowledge to head in the right direction.

For many years, X11 has been unable to correctly handle the use case in which Caps Lock is mapped to an extra backspace key. This was reported as early as 2012, as far as I can tell, with #299134 (https://bugs.kde.org/show_bug.cgi?id=299134). The behavior is that the Caps Lock key is input only once, with no ability to repeat. This makes it not helpful as a backspace key.

With KWin on Wayland, this behavior works correctly, *in Wayland applications*. XWayland apps still suffer from the bug, and the previously noted workaround of inputting ``xmodmap -e "clear lock"`` in a shell doesn't help anymore. This is probably still a bug with the X server.

What's really confusing is that sometime in the last year, Electron applications started being affected by this bug too, even when using the correct flags to enable a native Wayland platform (e.g. ``code --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland``). Could it be the case that it started using XWayland under the hood, and therefore now suffers from the bug?

If I had to guess, this isn't KWin's fault either way, but I'm trying to get some renewed interest around this now 12 year old issue. It's been driving me up the wall for years now, so I'll happily contribute any way I can towards fixing it.


STEPS TO REPRODUCE
1. System Settings -> Keyboard -> Advanced.
2. Click "Configure Keyboard Options".
3. "Caps Lock Behavior" -> Enable "Make Caps Lock an additional Backspace".
4. Open a native Wayland application (for instance, any KDE app) and observe the newly mapped Backspace key repeating correctly.
5. Open an XWayland application (for instance, a Java application like Ghidra) and observe how the Backspace key does not repeat correctly.
6. Open an Electron application (for instance, VS Code) and observe how the Backspace key does not repeat correctly.

OBSERVED RESULT
Caps Lock key mapped as Backspace should repeat for all software.

EXPECTED RESULT
Caps Lock key mapped as Backspace only repeats with Wayland-native software, excluding Electron apps.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 23.04
(available in About System)
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
This is reproducible on any distro I've tried.