Keyboard configuration for Xorg does not work

I recently installed FreeBSD 14.3, then added the xorg and xfce packages as described in the handbook.

Everything works quite well, except for the keyboard layout setting. The default config files contain the following sections:

Code:
# /usr/local/share/X11/xorg.conf.d/20-evdev-kbd.conf
Section "InputClass"
    Identifier        "Evdev keyboard"
    MatchDevicePath        "/dev/input/event*"
    MatchIsKeyboard        "on"
    Option            "XkbRules" "evdev"
EndSection

# /usr/local/share/X11/xorg.conf.d/40-libinput.conf
Section "InputClass"
        Identifier "libinput keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Starting the desktop environment, I get the following settings for the keyboard:

Code:
# setxbpmap -query
rules:      evdev
model:      pc105
layout:     us

To switch to a German layout automatically, I created a custom config file (following the handbook, but also using the hints in the 40-libinput.conf file quoted above):

Code:
/usr/local/etc/X11/xorg.conf.d/00-keyboard.conf
Section "InputClass"
        Identifier "libinput keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "XkbLayout" "de"
        Option "XkbOptions" "caps:escape"
EndSection

Section "InputClass"
        Identifier "Evdev keyboard"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Option "XkbLayout" "de"
EndSection

With this file in place, starting the Xorg server still leaves me with a US layout. I also tried KeyBoardDefaults as identifier (without success). The log does not provide a hint:


Code:
# /var/log/Xorg.0.log
[    18.953] (**) System keyboard multiplexer: Applying InputClass "Evdev keyboard"
[    18.953] (**) System keyboard multiplexer: Applying InputClass "libinput keyboard catchall"
[    18.953] (**) System keyboard multiplexer: Applying InputClass "libinput keyboard catchall"
[    18.953] (**) System keyboard multiplexer: Applying InputClass "Evdev keyboard"
[    18.953] (II) LoadModule: "libinput"
[    18.953] (II) Loading /usr/local/lib/xorg/modules/input/libinput_drv.so
[    18.960] (II) Module libinput: vendor="X.Org Foundation"
[    18.960]     compiled for 1.21.1.18, module version = 1.3.0
[    18.960]     Module class: X.Org XInput Driver
--
[    19.006] (**) Sleep Button: Applying InputClass "Evdev keyboard"
[    19.006] (**) Sleep Button: Applying InputClass "libinput keyboard catchall"
[    19.006] (**) Sleep Button: Applying InputClass "libinput keyboard catchall"
[    19.006] (**) Sleep Button: Applying InputClass "Evdev keyboard"
[    19.006] (II) Using input driver 'libinput' for 'Sleep Button'
[    19.006] (**) Sleep Button: always reports core events
[    19.006] (**) Option "Device" "/dev/input/event3"
[    19.008] (II) event3  - Sleep Button: is tagged by udev as: Keyboard
[    19.008] (II) event3  - Sleep Button: device is a keyboard
--
[    19.012] (**) AT keyboard: Applying InputClass "Evdev keyboard"
[    19.012] (**) AT keyboard: Applying InputClass "libinput keyboard catchall"
[    19.012] (**) AT keyboard: Applying InputClass "libinput keyboard catchall"
[    19.012] (**) AT keyboard: Applying InputClass "Evdev keyboard"
[    19.012] (II) Using input driver 'libinput' for 'AT keyboard'
[    19.012] (**) AT keyboard: always reports core events
[    19.012] (**) Option "Device" "/dev/input/event4"
[    19.014] (II) event4  - AT keyboard: is tagged by udev as: Keyboard
[    19.014] (II) event4  - AT keyboard: device is a keyboard

Why is my custom configuration ignored, and how can I fix this?
 
I notice that my keyboard config is much simpler
Code:
root@kg-core2:~ # more /usr/local/etc/X11/xorg.conf.d/keyboard-no.conf
Section "InputClass"
        Identifier "keyboard defaults"
        MatchIsKeyboard "on"
        Option      "XkbLayout" "no"
EndSection
Perhaps you are over-complicating things? Unless you need to have more than one keyboard and different layouts on each, why not have just one file which sets the layout for the keyboard?
 
I have given up on xorg.conf for my de keyboard long ago (at least in 7.3 it was buggy) and simply used setxkbmap -model pc105 -layout de -variant nodeadkeys in my
.xinitrc ever since. Works like a charm for a decade now.
 
I also think like tingo that you are breaking something with the default.

My config:
Code:
phil@galileo ~ $ cat /usr/local/etc/X11/xorg.conf.d/00-keyboard.conf  
Section "InputClass"
    Identifier  "Keyboard1"
    MatchIsKeyboard "on"
    Option "XkbLayout" "de"
    Option "XkbModel" "pc104"
    Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection
 
I notice that my keyboard config is much simpler
Code:
root@kg-core2:~ # more /usr/local/etc/X11/xorg.conf.d/keyboard-no.conf
Section "InputClass"
        Identifier "keyboard defaults"
        MatchIsKeyboard "on"
        Option      "XkbLayout" "no"
EndSection
Perhaps you are over-complicating things? Unless you need to have more than one keyboard and different layouts on each, why not have just one file which sets the layout for the keyboard?
Thank you! Reducing my config file to the above (with the addition of Option "XkbOptions" "caps:escape") did the trick. If this would not have worked, I was planning to use ~/.xinitrc as suggested by other replies.
 
Back
Top