Different keyboard layouts for different keyboards

Created: 2017-03-14 — modified: 2018-02-23 — tags: Linux

On Linux, you can have different keyboard layouts for different physical keyboards. How? Easy!

Just add a line like this:

SUBSYSTEM=="input", ACTION=="add", ENV{ID_SERIAL}=="046a_0011", ENV{XKBLAYOUT}="us,ru", ENV{XKBVARIANT}=",winkeys", ENV{XKBOPTIONS}="grp:lalt_lshift_toggle,grp_led:caps,caps:escape,nbsp:level2,terminate:ctrl_alt_bksp"

to your /etc/udev/rules.d/zz-local.rules file (create it if it doesn't exist).