Configure X: multiple keyboard layouts ?

Frank Shute frank at
Sun Mar 7 20:44:48 UTC 2010

On Sun, Mar 07, 2010 at 11:09:16AM +0100, Niki Kovacs wrote:
> Hi,
> I'd like to configure X for multiple keyboard layouts, e. g.:
> - french
> - swiss french
> - german
> On my Linux box (running CentOS 5.4 and a dated version of, the 
> configuration for this looks like this :
> Section "InputDevice"
>   Identifier  "Keyboard0"
>   Driver      "kbd"
>   Option      "XkbModel" "pc105"
>   Option      "XkbLayout" "fr,ch,de"
>   Option      "XkbVariant" ",fr,"
>   Option      "XkbOptions" "grp:alt_shift_toggle"
> EndSection
> This stanza enables me to toggle between different keyboard layouts, 
> using the [Alt]+[RightShift] key combination. You might wonder about the 
> XkbVariant option: the swiss keyboard layout has two variants: fr and 
> de. This is to indicate the swiss roman layout.
> Now is there any way I could achieve a similar thing with the more 
> recent shipping with FreeBSD 8.0 ?
> Any suggestions ?

Hi Niki,

Welcome to FreeBSD!

There is a way to achieve similar results with recent

X nowadays can get by without an xorg.conf and by default it uses hald
and dbus to configure keyboard, mouse etc.

It's documented how you can create an xorg.conf and use that for
device config rather than hald:

You basically create an xorg.conf and then add:

Option "AutoAddDevices" "false"

to the ServerLayout section and then your keyboard config placed in
your xorg.conf will be picked up.

You will also need a section for the mouse along the lines of:

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "CorePointer"
        Option      "Protocol" "auto"
        Option      "Device" "/dev/sysmouse"
#       Option      "Emulate3Buttons" "false"
        Option      "ZAxisMapping" "4 5 6 7"	# For scroll wheel

It's parameters are dependent on your type of mouse.

With that and xorg.conf placed under /etc/X11/ you should be good to

But I'm quite sure you know that xorg.conf can be a fiddle ;)

If you get stuck, post your xorg.conf

BTW, if you haven't read it already the manpage for moused(8) is quite
a revelation. The FreeBSD mouse driver puts the Linux mouse driver to




 Contact info:

More information about the freebsd-questions mailing list