OpenBSD Journal

Heads up! - Xorg detects keyboard layout on the fly

Contributed by johan on from the next-patch-is-for-nonUS-mouse-support dept.

Matthieu Herrb (matthieu@) has committed support for Xorg to detect the keyboard layout based on the wscons keymap being used.

What this means to us is that one of the final obstacles to running X without a pre-made xorg.conf(5) file is now gone. This should make it considerably easier to run X11 for users with a non-US keyboard layout.

The idea and initial diff was contributed by Reyk Floeter (reyk@).

Furthermore, keyboard layouts are referred to differently in wscons(4) and Xorg(1) for some countries. This meant that for example the Swedish keyboard layout which is named "sv" in wscons(4) would not get automatically detected because it is named "se" in Xorg. Mats O Jansson (maja@) solved this by adding a lookup table to the xf86-input-keyboard driver.

There is one exception - if you alter your keymap by means of wsconsctl(8) your keymap will become "user" in which case this will not work.

Go ahead and try using Xorg without xorg.conf(5) yourself next time you install X on an OpenBSD computer.

(Comments are closed)


Comments
  1. By Tom Van Looy (tvlooy) tom@ctors.net on

    This is great news, I think lots of people will like it (including me)!

  2. By Anonymous Coward (88.89.138.252) on

    The less to configure, the better. Thanks!

  3. By Anonymous Coward (147.175.160.157) on

    If you own a USB Keyboard the layout still gets reset to US-Layout if you unplug and reconnect the kayboard.. :-)

    Tested so far on the console 'course I didn't had X on the FW

    Comments
    1. By Renaud Allard (renaud) on

      > If you own a USB Keyboard the layout still gets reset to US-Layout if you unplug and reconnect the kayboard.. :-)
      >

      Still better than most (all?) other OSes.

    2. By Anonymous Coward (87.173.90.69) on

      > If you own a USB Keyboard the layout still gets reset to US-Layout if you unplug and reconnect the kayboard.. :-)
      >
      > Tested so far on the console 'course I didn't had X on the FW

      There is a kernel option which you can use to set the default layout of your usb one.
      Of course I don't apper to have it handy at the moment neither do I find it with my favorite search engine.
      Anyone I hit a light at please raise your hands!!

      Comments
      1. By Anonymous Coward (140.112.14.181) on

        > > If you own a USB Keyboard the layout still gets reset to US-Layout if you unplug and reconnect the kayboard.. :-)
        > >
        > > Tested so far on the console 'course I didn't had X on the FW
        >
        > There is a kernel option which you can use to set the default layout of your usb one.
        > Of course I don't apper to have it handy at the moment neither do I find it with my favorite search engine.
        > Anyone I hit a light at please raise your hands!!

        I angree I didn't knew about this but this option should (must? :) ) get set during the installation where you are asked for the layout.

        If I would know the responseable for the installer I would ask him if it's possible to edit the "correct" sysctl-value and add it to the sysctl.conf if that realy does the job.

        I just was confused that the layout gets lost and I wondered that nobody els enoticed this (or reported it).
        I am sure the usual user may wont dig intot he kernel to get a kayboard layout set (nor does he/she either care or has the time :( )

        It would be great if modifying the installer would be an accaptable option because it would solve this completly if it can get set with a sysctl-command.

  4. By Artis (artis) artis@proit.lv on

    there's no need to touch xorg.conf, it can be done by setxkbmap(1) in either .xsession or .xinitrc

    Comments
    1. By Anonymous Coward (195.29.148.251) on

      > there's no need to touch xorg.conf, it can be done by

      Many many times I used setxkbmap to change US keyboard to DE (german) and vice versa resulted in X server freezing a machine. Only reboot helped. I experienced this bug in OpenBSD 3.9 (that was my first OpenBSD install) but it still existed in 4.0, 4.1 and 4.2. Don't know about 4.3 (haven't yet installed it).

      This bug prevented me to use OpenBSD as a desktop OS.

      Comments
      1. By Otto Moerbeek (otto) on http://www.drijf.net

        > > there's no need to touch xorg.conf, it can be done by
        >
        > Many many times I used setxkbmap to change US keyboard to DE (german) and vice versa resulted in X server freezing a machine. Only reboot helped. I experienced this bug in OpenBSD 3.9 (that was my first OpenBSD install) but it still existed in 4.0, 4.1 and 4.2. Don't know about 4.3 (haven't yet installed it).
        >
        > This bug prevented me to use OpenBSD as a desktop OS.

        Did you file a proper bug report?

        -Otto

      2. By thib (83.246.89.10) on

        > > there's no need to touch xorg.conf, it can be done by
        >
        > Many many times I used setxkbmap to change US keyboard to DE (german) and vice versa resulted in X server freezing a machine. Only reboot helped. I experienced this bug in OpenBSD 3.9 (that was my first OpenBSD install) but it still existed in 4.0, 4.1 and 4.2. Don't know about 4.3 (haven't yet installed it).
        >
        > This bug prevented me to use OpenBSD as a desktop OS.
        No, your laziness prevented you from using OpenBSD as a desktop OS.

        I'd bet, that if you had filed a proper bug report, and offered to work with a developer or other users, this issue would have been solved...

  5. By Tom Van Looy (tvlooy) tom@ctors.net on

    Will this change go upstream to the X.org project?

  6. By Paul Irofti (91.199.104.3) bulibuta@gmail.com on

    This is one of the things that kept me from removing my xorg.conf, but the other one is font paths. How can I set those w/o xorg.conf?

    Comments
    1. By Jan J (130.237.95.28) on

      > This is one of the things that kept me from removing my
      > xorg.conf, but the other one is font paths. How can I set those
      > w/o xorg.conf?

      xset should do the trick.

    2. By phessler (phessler) on first undead, then not, then undead again.

      > This is one of the things that kept me from removing my xorg.conf, but the other one is font paths. How can I set those w/o xorg.conf?
      $ cat ~/.xinitrc
      xset fp+ /usr/local/lib/X11/fonts/freefont/
      xset fp+ /usr/local/lib/X11/fonts/mscorefonts/
      xset fp+ /usr/local/lib/X11/fonts/ghostscript/
      xset fp+ /usr/local/lib/X11/fonts/terminus/
      xset fp+ /usr/local/lib/X11/fonts/Liberation/
      xset fp+ /usr/local/lib/X11/fonts/ecoliercourt/
      $
      

Latest Articles

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]