Bug 433813 - Using "Caps lock is also ctrl" XKB settings in keyboard KCM sometimes causes key released events to not fire when releasing caps lock key
Summary: Using "Caps lock is also ctrl" XKB settings in keyboard KCM sometimes causes ...
Status: RESOLVED NOT A BUG
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keyboard (other bugs)
Version First Reported In: 5.21.1
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-01 19:48 UTC by e.insafutdinov
Modified: 2023-01-04 21:52 UTC (History)
2 users (show)

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


Attachments
KDE keyboard settings: Caps Lock as Ctrl (168.97 KB, image/png)
2021-03-03 04:38 UTC, e.insafutdinov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description e.insafutdinov 2021-03-01 19:48:51 UTC
Ctrl-Tab shortcut allow to access previous tabs in apps like VS Code and Firefox.

STEPS TO REPRODUCE
1. Launch VS Code or Firefox with several open tabs
2. Simply use Ctrl-Tab to switch between tabs

OBSERVED RESULT

This is how tab switching works in Plasma. Pressing Ctrl-Tab brings up the tab switching window, however when releasing Ctrl button it does not switch to the previous tab and the tab switcher window is still on. I can navigate the tab thumbnails and then select Enter to select the desired tab. This behavior is unintuitive, is not consistent with how Firefox works on Windows (or Gnome) and also not consistent with the conventional Alt-Tab window switching in most of the desktop environments.

EXPECTED RESULT

This is how it works on Windows and how it should work. Pressing Ctrl-Tab brings up the tab switching window. While holding Ctrl one uses Tab or arrow buttons to navigate to the desired browser tab. Releasing Ctrl then performs the switching to the tab.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE neon 5.21
KDE Plasma Version: 5.21
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
I'm not sure whether kwin is the right category for the bug report so feel free to move it elsewhere.
Comment 1 Nate Graham 2021-03-02 19:34:15 UTC
Firefox and VSCode define what Ctrl+Tab does for themselves. Plasma or any other KDE software has no impact on it. You'd need to report this to them. Thanks!
Comment 2 e.insafutdinov 2021-03-02 20:16:32 UTC
I already reported this issue in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1695416), the maintainer tried to reproduce it on Ubuntu with Gnome and it worked there correctly. I also tried it in Gnome myself, and it worked there correctly. Furthermore, VS Code is also affected on KDE. This led me to the conclusion that it's a KDE-specific issue because it affects multiple applications and it works correctly on different platforms.
Comment 3 Nate Graham 2021-03-02 20:18:22 UTC
Unless I'm misunderstanding the original bug report, there is 0% chance that any KDE code is affecting this. We don't have anything that alters the way Ctrl+Tab works for 3rd-party apps.

Maybe you can attach a screen recording that shows the problem?
Comment 4 e.insafutdinov 2021-03-02 21:22:23 UTC
Here's the video (https://drive.google.com/file/d/1kimGpEYPm3pwoLxYKRQhcrAfym70Db1r/view), but it won't tell you much. The problem is, as I already said, that Ctrl-Tab brings up the pop-up window with thumbnails of tabs, however this pop-up remains on-screen even after I *release* Ctrl button. This does not happen on any other DE (Windows or Gnome). I have a fresh installation KDE, so I it's highly unlikely that I messed up with the configuration. Anyone with KDE and Firefox or VS Code can reproduce this behaviour.
Comment 5 Nate Graham 2021-03-03 01:13:59 UTC
My Firefox doesn't have that effect when I cycle through tabs with Ctrl+Tab. Is that functionality provided by a 3rd-prty add-on or something?
Comment 6 e.insafutdinov 2021-03-03 04:38:48 UTC
Created attachment 136334 [details]
KDE keyboard settings: Caps Lock as Ctrl
Comment 7 e.insafutdinov 2021-03-03 04:47:34 UTC
Thanks a lot for looking it! After you tried it, I realised that the problem is due to me using Caps Lock as Ctrl. When using the actual Ctrl key, I get the correct behavior: releasing the Ctrl key switches the tab as expected.

Having said that, I remapped Caps Lock to Ctrl in the KDE System Settings app (see the attached screenshot). And I believe that the issue is that while Caps Lock acts as Ctrl when pressing the key, it doesn't do so when *releasing* the key, which is verified by the incorrect behavior in Firefox and VS Code applications that utilise releasing of Ctrl.

I tried remapping Caps Lock to Ctrl with the command `setxkbmap -option ctrl:nocaps` and I get correct behavior when releasing the key. So I still believe it's a problem that needs to be addressed on the KDE side, in the System Settings for keyboard.
Comment 8 Nate Graham 2021-03-03 18:39:49 UTC
Thanks for narrowing that down.

Still, I'm wondering where you got that fancy visualization for your Firefox tab switcher. I won't be able to confirm the issue until I can get that to appear for myself.
Comment 9 e.insafutdinov 2021-03-03 19:00:22 UTC
Hi Nate,

It's hard for me to say, this windows has always been there for me. Maybe because I recycle the my own configuration. Here are the relevant Firefox settings:

browser.ctrlTab.recentlyUsedOrder: True
services.sync.prefs.sync.browser.ctrlTab.recentlyUsedOrder: True

Also, make sure to hold Ctrl after pressing Ctrl-Tab, this window takes a second to pop up.

If you still cannot reproduce it in Firefox, you could try Visual Studio Code - just recycle last opened editor tabs with Ctrl-Tab, here is a screengrab:

https://drive.google.com/file/d/12ddThuxndNbXeNR5ZVYwvIKWLZxV5SSe/view

I just checked, Atom editor also cycles between recent editor tabs with Ctrl-Tab.
Comment 10 Vlad Zahorodnii 2021-03-05 10:20:13 UTC
Are you using Plasma on X11 or Plasma on Wayland?
Comment 11 e.insafutdinov 2021-03-05 10:34:42 UTC
Hi, Vlad. I am using Plasma on X11 with NVIDIA proprietary drivers if that helps.
Comment 12 e.insafutdinov 2022-12-31 13:38:19 UTC
Upgraded to Plasma 5.25.5 and the bug is still there.
Comment 13 e.insafutdinov 2023-01-04 21:52:19 UTC
OK, I found out what I've been doing wrong. There are two ways to map CAPS LOCK to CTRL: one is "Caps Lock behavior -> Make Caps Lock an additional Ctrl" and another one "Ctrl Position -> Caps Lock as Ctrl". The issue I reported only affected the former option while the latter one works correctly. This is a bit confusing but works for me, hence closing the issue.