Bug 478046

Summary: Cannot configure two ways to switch layout
Product: [Plasma] kwin Reporter: Éric Brunet <eric.brunet>
Component: inputAssignee: KWin default assignee <kwin-bugs-null>
Status: REPORTED ---    
Severity: normal Flags: eric.brunet: Wayland+
Priority: NOR    
Version First Reported In: 5.27.9   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Éric Brunet 2023-12-04 14:11:11 UTC
I am using KDE+Wayland on a fully uptodate Fedora 39 laptop. I am using a french keyboard, but I also want to enter greek letters and so I have configured my keyboard with these two layouts, and I have set the Windows key as a modifier to change layout while pressed.

My `.config/kxkbrc` file looks like this:
```
[$Version]
update_info=kxkb.upd:remove-empty-lists,kxkb.upd:add-back-resetoptions,kxkb_variants.upd:split-variants

[Layout]
DisplayNames=,
LayoutList=fr,gr
Options=grp:win_switch,compose:rctrl,terminate:ctrl_alt_bksp
ResetOldOptions=true
Use=true
VariantList=oss,polytonic
```
With the `grp:win_switch` setting, while I press the "Windows" key of my laptop, the keyboard layout is changed to greek. (So that `Win+d` gives `δ`, for instance.)  Recall that without this option, the "Windows" key is interpreted as "Menu" if I press and release it, or as "Meta" if I press it with another key (so that `Win + d`, interpreted as `Meta + d`, shows the desktop without any window as per the standard kwin shortcuts).

I tried to add another shortcut to toggle keyboard layouts (using the graphical interface), so that my `.kxkbrc` looks like
```
[$Version]
update_info=kxkb.upd:remove-empty-lists,kxkb.upd:add-back-resetoptions,kxkb_variants.upd:split-variants

[Layout]
DisplayNames=,
LayoutList=fr,gr
Options=grp:win_switch,compose:rctrl,terminate:ctrl_alt_bksp,grp:lctrl_lwin_toggle
ResetOldOptions=true
Use=true
VariantList=oss,polytonic
``
With the option `grp:lctrl_lwin_toggle`, hitting `Left Ctrl + Left Win` switches the keyboard between my two layouts, french and greek. This toggle shortcut works well, but then the first option `grp:win_switch` is ignored: the "Windows" key used alone is seen as a "Menu" key, and `Win + key` is interpreted as `Meta + key`; in particular, `Win + d` shows the desktop.

The system config interface lets me select several ways to switch layouts, and there is nothing logically incompatible between the two options I tried to set at the same time. They should both work together.