New Xorg - different key-codes

Michael Gmelin freebsd at
Thu Mar 12 10:12:36 UTC 2020

On Thu, 12 Mar 2020 10:31:40 +0100
Alexander Leidinger <Alexander at> wrote:

> Hi,
> This command sets the keyboard layout. You are supposed to set the
> keyboard layout which matches the physical layout of the hardware.
> This hadn't changed, it's a fundamental part of X11 since I know it
> (X11 6.5) and even before...
> [snip]

Exactly. I just personally prefer to use setxkbmap, as all my setups are
single user (one unprivileged user per machine that runs X, no shared
machines) and customization happens in $HOME that way. Makes it a
bit easier to setup a new machine (no digging in Xorg configs) and
reading ~/.xinitrc basically tells me all about my current config.

Plus, setxkbmap makes it easy to experiment, as it's applies changes
while X is running, even if one makes the those changes permanently in
an xorg config file later. And the resulting command is just one line
(in my case as short as "setxkbmap -model pc105 -layout de"), makes it
easier to support people.

Another useful application of the command is for debugging:
"setxkbmap -query" will tell you what's currently configured (regardless
how that configuration was done), e.g.,

On a machine running xorg 1.18:

# setxkbmap -query
rules:      base
model:      pc105
layout:     de

On a machine running xorg 1.20:
rules:      evdev
model:      pc105
layout:     de

In both cases the same setxkbmap command was used in ~/.xinitrc to set
model and layout. Rules were taken from Xorg's default config, which
changed to evdev in 1.20.


Michael Gmelin

More information about the freebsd-current mailing list