These days, on modern Linux systems, Xorg pretty much configures itself. Gone are the days of carefully assembling a working xorg.conf file. Xorg even seems to ignore any xorg.conf available. That’s nice if it all works great, but what if Xorg decides to ignore your non-US keyboard layout ?

Around here (Belgium), most of us use keyboards with Azerty layout. In most GUI environments (KDE, XFCE, …) , you can select the Belgian keyboard layout, and that’s it. It appears to work just fine. But does it always work as expected ?
Well, no, it doesn’t: some applications, like say xscreensaver, xlock or graphical login managers seem to ignore the keyboard layout as set by your GUI. This can lead you to the rather embarassing situation where you have trouble logging in, once xscreensaver has kicked in, because it appears to use the qwerty keyboard layout.

To get rid of this problem, you have to create the following configuration file:
/etc/X11/xorg.conf.d/10-keyboard.conf .

The content looks like this:

    Section "InputClass"
       Identifier "system-keyboard"
       MatchIsKeyboard "on"
       Option "XkbLayout" "be"
       Option "XkbModel" "pc104"

Restart Xorg, and your Azerty keyboard should now always work correctly, in every X application.