[arch-general] Weird glitch with X keymap

Mauro Santos registo.mailling at gmail.com
Fri Aug 28 10:34:24 UTC 2015

Like the subject says I have stumbled upon a weird glitch with X keymap.

The TL;DR version is the keymap on a usb keyboard that I have connected
to my laptop is wrong until I press any key on my laptop's keyboard. I
have a workaround in place but I would like to fix this properly.

Now the long version. I am configuring X's keymap with
/etc/X11/xorg.conf.d/00-keymap.conf, which contains:

Section "InputClass"
    Identifier        "Keyboard Defaults"
    MatchIsKeyboard   "yes"
    Option            "XkbLayout" "pt"
    Option            "XkbOptions" "terminate:ctrl_alt_bksp"

I'm using XFCE and it should not be messing with the keyboard
configuration, the keyboard configuration utility is set to "Use system
defaults". If I'm using only my laptop's built-in keyboard this works as
expected and the pt keymap is (or seems to be) properly set as soon as
XFCE starts.

Now I have a usb mouse/keyboard combo (Logitech MK520) connected to the
laptop, as I have put the laptop to the side to use a larger monitor.
The weird problem manifests itself when starting XFCE either if starting
XFCE with the keyboard already plugged in or if I plug the keyboard
after start XFCE.

If I start XFCE and use the laptop's keyboard first, the keymap is correct.
If I start XFCE and use the usb keyboard first, the keymap is wrong, as
far as I can tell it seems to be using the us keymap.
If I start XFCE and press any key on laptop's keyboard before using the
usb keyboard, then the keymap on the usb keyboard is correct.

I have looked through X's logs and nothing seems to be out of place and
the pt layout is the only thing that is present in the logs, there is no
mention to the us layout.

The output of 'setxkbmap -query -v' is the same before and after
pressing any key on the laptop's keyboard to "fix" the problem with the
usb keyboard. There is nothing on the journal or dmesg that might point
to the problem.

The workaround I have in place is using running 'setxkbmap pt'
automatically (via autostart) after I start XFCE, in this case things
work as they should.

Google did not help with this and the is nothing on the wiki about this
weird problem. Has anyone seen this behavior before? Any ideas on how I
can properly fix this?

Mauro Santos

More information about the arch-general mailing list