Bug 458699

Summary: Lock Keys Status plasmoid incorrectly shows Caps Lock status when using "Use keyboard LED to show alternative layout -> Caps Lock" setting
Product: [Plasma] kdeplasma-addons Reporter: Coacher <itumaykin+kde>
Component: Keyboard IndicatorAssignee: Plasma Bugs List <plasma-bugs>
Status: CONFIRMED ---    
Severity: minor CC: aleixpol, butirsky, kde, lemmyg, nate
Priority: NOR    
Version: 5.25.4   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Coacher 2022-09-04 14:09:34 UTC
STEPS TO REPRODUCE
1. Add 'Lock Keys Status' widget to the system tray
2. Configure Caps Lock key to switch layouts (via localectl or systemsettings)
3. Switch to a different layout using Caps Lock key

OBSERVED RESULT
'Lock Key Status' tray icon shows that Caps Lock is activated, but actually it isn't

EXPECTED RESULT
'Lock Keys Status' tray icon doesn't show that Caps Lock is activated


SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 36
KDE Plasma Version: 5.25.4
KDE Frameworks Version: 5.97.0
Qt Version: 5.15.5
Kernel Version: 5.19.6-200.fc36.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5700U with Radeon Graphics
Memory: 14,5 GiB of RAM
Graphics Processor: AMD RENOIR
Manufacturer: LENOVO
Product Name: 20Y7003TRT
System Version: ThinkPad E14 Gen 3

ADDITIONAL INFORMATION
Used to work properly about 3 weeks ago. Presumably KDE update broke something.
Comment 1 galder 2022-09-04 17:49:56 UTC
Hello,
I'm confuse with the request. 
Why would you want to use the standard Caps Lock key the switch the keyboard layout?
Are you not using it when writing text?

I feel like this is very personal usage of Caps Lock key and the widget is working as expected.

Regards
Comment 2 Coacher 2022-09-05 16:59:35 UTC
> Why would you want to use the standard Caps Lock key the switch the keyboard layout?
It is a well-placed single button layout switch. When using layouts in different languages one has to often switch between them, e.g. programming in English, talking to colleagues in another language.

> Are you not using it when writing text?
Writing something in all caps is much more rare occasion, than switching layouts in a multi-language setup. I use Shift+Caps when I need the original Caps Lock function.

This configuration is not that uncommon, e.g. ArchWiki suggests it as the default method to switch layouts: https://wiki.archlinux.org/title/Xorg/Keyboard_configuration#Switching_between_keyboard_layouts

Anyway, putting all personal preferences aside XKB (grp:caps_toggle) and KDE (systemsettings) support this configuration, so it is expected to be supported by Plasma properly.
Comment 3 galder 2022-09-05 19:35:58 UTC
ok, thanks for explanation.
Lets see if we have some inputs from developers.

Regards
Comment 4 Nate Graham 2022-09-09 03:56:23 UTC
Can you specify *exactly* how you set the caps lock key up to switch layouts?

I ask because I have used the Advanced tab of the Keyboard page to use my caps lock key to be the Compose key, and when doing it this way, it no longer functions as a caps lock key at all and thus doesn't trigger the widget's detection. This is probably the kind thing you want to do as well.
Comment 5 Coacher 2022-09-10 07:33:21 UTC
(In reply to Nate Graham from comment #4)
> Can you specify *exactly* how you set the caps lock key up to switch layouts?
> 
> I ask because I have used the Advanced tab of the Keyboard page to use my
> caps lock key to be the Compose key, and when doing it this way, it no
> longer functions as a caps lock key at all and thus doesn't trigger the
> widget's detection. This is probably the kind thing you want to do as well.

# localectl --no-convert set-x11-keymap us,ru pc104 '' grp:caps_toggle,grp_led:caps
# systemctl reboot

The problem persists if after this I additionally configure Caps Lock key as the main layout switching shortcut in systemsettings -> Input Devices -> Keyboard -> Layouts.
Comment 6 Nate Graham 2022-09-12 18:02:51 UTC
Thanks. 

I cannot reproduce the problem on Fedora 36 with the Wayland session. Does it also happen if you make your caps lock get into your compose key (rather than being the layout switching key) using the Keyboard Layouts page in System Settings
Comment 7 Coacher 2022-09-12 18:27:35 UTC
Same here: Fedora 36 with Wayland session.
Could you please provide a more specific way to toggle the option you've mentioned? I'm not familiar with compose keys.
Comment 8 Nate Graham 2022-09-12 23:44:14 UTC
System Settings > Input Devices > Keyboard > "Advanced" tab > Position of Compose key > Caps Lock
Comment 9 Coacher 2022-09-13 05:30:09 UTC
(In reply to Nate Graham from comment #8)
> System Settings > Input Devices > Keyboard > "Advanced" tab > Position of
> Compose key > Caps Lock

Enabling this option prevents me from using Caps Lock as the layout switch key. Caps Lock now doesn't seem to have any effect at all.
Comment 10 Nate Graham 2022-09-13 14:29:51 UTC
Yes, you can only use the caps lock key for one thing at a time with the options on that page.

In terms of effect, focus a text field, press the Caps Lock key, and press the "u" key twice. You should see it type "ŭ". If it does that, then you have successfully set the Caps Lock key as your Compose key. In this state, does pressing it trigger the Lock Keys Status plasmoid?
Comment 11 Coacher 2022-09-13 18:27:25 UTC
(In reply to Nate Graham from comment #10)
> Yes, you can only use the caps lock key for one thing at a time with the
> options on that page.
> 
> In terms of effect, focus a text field, press the Caps Lock key, and press
> the "u" key twice. You should see it type "ŭ". If it does that, then you
> have successfully set the Caps Lock key as your Compose key. In this state,
> does pressing it trigger the Lock Keys Status plasmoid?

Yes, if I press "u" key twice, I can see "ŭ" in the input field. In this state plasmoid is not triggered.
Comment 12 Nate Graham 2022-09-13 18:37:31 UTC
Ok, great. Now, in that same table view, unset Caps Lock as your Compose key, and check the checkbox by "Switching To Another Layout > Caps Lock".

Now, when you press Caps Lock, does the Lock Keys Plasmoid get triggered?
Comment 13 Coacher 2022-09-13 18:57:52 UTC
(In reply to Nate Graham from comment #12)
> Ok, great. Now, in that same table view, unset Caps Lock as your Compose
> key, and check the checkbox by "Switching To Another Layout > Caps Lock".
> 
> Now, when you press Caps Lock, does the Lock Keys Plasmoid get triggered?

No, it isn't triggered this way.

I've done a bit more experimenting. If I enable "Switching To Another Layout -> Caps Lock" AND "Use keyboard LED to show alternative layout -> Caps Lock", then the plasmoid triggers on layout switches. In kxkbrc I see the same options as in my localectl config: "grp:caps_toggle,grp_led:caps".
Comment 14 Nate Graham 2022-09-15 15:58:32 UTC
It would appear that  "Use keyboard LED to show alternative layout -> Caps Lock" is the culprit here. Can confirm that.
Comment 15 Coacher 2024-07-09 14:37:35 UTC Comment hidden (spam)
Comment 16 Coacher 2024-10-23 19:56:47 UTC Comment hidden (spam)
Comment 17 Nate Graham 2024-10-23 20:35:47 UTC Comment hidden (spam)
Comment 18 Coacher 2024-10-24 07:07:06 UTC
(In reply to Nate Graham from comment #17)
> Please don't change version numbers or report that something is still a
> problem. If the bug report is open, it's safe to assume it's still a problem.

Ok