KDE keyboard shortcuts don't respect the current layout

I have two keyboard layouts configured in KDE System Settings on my laptop; “English (US) - Colemak” and “English (US)” (in that order).

When working with “English (US) - Colemak”, all KDE shortcuts (both default and custom) work as expected.
However, if I switch to “English (US)” (whether with a keyboard shortcut, or through the Keyboard Layout widget on the System Tray), the shortcuts get twisted.

Let’s take an example. The “Peek at Desktop” shortcut, by default, is assigned to Meta+D.
The shortcut works fine with “English (US) - Colemak”.
When I switch to “English (US)”, of course, the “D” key moves - when typing in an editor/browser, the key is in the expected position. But when I try to use Meta+D to “Peek at Desktop”, nothing happens. Instead I have to press Meta+G to run this shortcut. In other words, I have to press the button that is normally “D” when I’m using “English (US) - Colemak”.

This pattern holds for other shortcuts as well - e.g., if I have a shortcut that runs on Meta+Shift+S in “English (US) - Colemak”, then I will need to press Meta+Shift+D to run this shortcut from “English (US)”.

So it seems like, when I switch keyboard layouts, the KDE shortcuts remain tied to the original/main layout.
Obviously, I would prefer that when I switch layouts, the KDE shortcuts “adjust”, so that I can use the same keys (albeit in different buttons/positions) to run the same shortcuts across multiple layouts.

Has anyone else experienced this behaviour when using two or more keyboard layouts?
Is there a solution?


Side note for why I’m using both of these layouts.
Colemak is my day-to-day layout, and when working on the laptop keyboard, I use “English (US) - Colemak”.
However, I often connect an external keyboard (ZSA Moonlander, which runs on QMK). This external keyboard is fully configurable, and I have manually assigned each button so that it has a Colemak layout.
For some reason (not sure the details on this, something to do with input mapping), this layout will only work properly with KDE if I’m using either “English (US)” layout, or no layout at all.
Obviously I can’t go with the latter option, as I generally have “English (US) - Colemak” enabled, so whenever I connect the keyboard I switch to “English (US)”.
The reason I left this detail out above is because the use of the external keyboard is not relevant to the problem - the keyboard shortcuts are mismatched only due to the KDE input setting, not due to the keyboard.

In English colemak layout, Meta+D is pressed like this

In English (US) layout, Meta+D is pressed like this

What you see it “expected behaviour” as the shortcuts don’t get bound to the individual letters, but to the keyboard scan codes, which are independent of the keyboard layout, so the only solution is to use identical internal and external keyboards…

(which is what I’m assuming is your problem: there are no internal Colemak keyboards)

So in your case, I’d use the US international keyboard layout on both internal and external keyboards. (Not as good as a Colemak, but gets you there 80%)

:cry:

1 Like

Dang, really not what I was hoping for… :sleepy:

I don’t think I can go back to typing on QWERTY at this point!

So I guess my solution is either to learn new shortcut positions for one keyboard, or find a different keyboard shortcut utility, or worst case, a new DE.

Slightly off-topic, but does anyone have any suggestions for either of the above?

and, if you reboot after switch , kde start with new key layout ? if yes (or exist option for change default?), no problem


another way
search if exist dbus command for (re)load shortcut config and run this command after layout switch

kde forum is a good place for theses questions

After rebooting, KDE will always automatically select whatever layout I had selected before shutting down.
However, the keyboard shortcuts will always be mapped based on the default layout - i.e., the one at the top of the list in System Settings > Input Devices > Keyboard > Layouts.
If I change the default layout, then the other layout (previously the default) will now have the same issue - keybindings in the wrong place, based on the new default layout.

Appreciate the suggestion for asking in KDE forum, I’ll move over there :+1:
I’ll still keep this post open in case anybody has any other suggestions, and if I find a solution I’ll update here.