Remap Keyboard Keys based on what keyboard being used
Andrew Henderson
I have a Dell XPS13 and I'm using a Keychron K2 keyboard. The keyboard layouts are different.
Is there a way of mapping different keys on the different keyboards? Either at the same time or some sort of easily accessed switch.
I usually have the Ctrl and Alt swapped, but they are different keys on the keyboards and the Fn key is located on the right side with the Keychron k2.
Any suggestions or help would be appreciated.
2 Answers
I am not aware of a possibility to automatically switch keyboard layouts depending on the keyboard that is in use. However, you can conveniently install more than a single keyboard layout in your system, and then switch between the keyboard layouts using a hotkey, which by default is Ctrl+Space.
In "Settings" - "Region and Languages", you can add another keyboard layout by clicking the + button under "Input Sources". You can change the hotkeys to switch forwards and backwards between different keyboard layouts (useful if you have more than two different layouts active) in "Settings" - "Keyboard Shortcuts" under the "Typing" section.
1The Solution ended up being even easier than going through xmodmap.
In Keyboard > Layouts > Options..., there's a keyboard Layout Option for "Ctrl position". I just checked "Right Ctrl as Right Alt" and "Swap Left Alt with Left Ctrl".
Both keyboards work as intended now.