Xkbmap issue when passing variant as a layout

|
1
minute
#linux#dotfiles#keyboard

Description

Recently, xkbmap received an update to version 1.3.4. This version includes improvements in Xwayland checks, but seems like they have changes the cli rules as well. If you try to switch the layout by passing the variant as an argument, you will encounter an error:

~> setxkbmap dvorak
Error loading new keyboard description

This issue occurs with any of the variants listed in xorg.lst

sed -n '/! variant/,/! option/p' /usr/share/X11/xkb/rules/xorg.lst

This was the first issue I encountered with xmodmap, and it was quite confusing since I had been using this variant for more than 10 years without any problems until the recent system update.

The fix

The fix is simple and intuitive:

# Here we specify 2 layouts: us dvorak and us qwerty.
# Since qwerty is the default one, you can just skip it, but you still need a comma.'
setxkbmap -layout "us,us" -variant "dvorak,"

Now, instead of directly passing variant as a layout, you should specify corresponding layout and its variant.

~>