Insight: My laptop has a German ISO keyboard layout. I bought an US ANSI keyboard for faster typing as I am programming. Now it flips the Y and Z key everytime I switch between DE and US grrrr.

How I switch between layouts
sxhkd (Hotkey Daemon): Switch between us ansi and de with a key binding
The config: ~/.config/sxhkd/sxhkdrc
sxhkdrc
|
|
But remember, it resets to default everytime you reboot.
Optional: Quickly reload sxhkd with super + escape
bash
|
|
Set the default keyboard layout
Customize the keyboard layout system wide: /etc/X11/xorg.conf.d/00-keyboard.conf
vim
|
|
To prevent swapping Y and Z, create a custom XKB symbols file (or modify existing us layout in /usr/share/X11/xkb/) so that Y remains where it is in German layout.
Created custom us_custom in /usr/share/X11/xkb/symbols
us_custom
|
|
Update sxhkd configuration
Now change the sxhkdrc accordingly:
sxhkdrc
|
|
Good luck!