2

I'm running Ubuntu 15.04 with xdm as the display manager, and a custom multi-monitor and keyboard setup defined in xorg.conf.

xdm picks up the keyboard config correctly, setting the layout to "gb", and with the caps and ctrl keys swapped.

However, when I start Window Maker, or any other display manager, I find that my keyboard layout reverts to US. The ctrl/caps keys stay swapped though.

xorg.conf:

Section "Monitor"
        Identifier   "DP1"
EndSection

Section "Monitor"
        Identifier   "HDMI2"
        Option       "LeftOf" "DP1"
        Option       "Rotate" "left"
EndSection

Section "Device"
        Identifier "intel"
        Driver     "intel"
#       Option     "TearFree" "true"
        Option     "Monitor-DP1" "DP1"
        Option     "Monitor-HDMI2" "HDMI2"
EndSection

Section "InputClass"
        Identifier      "caps as ctrl sun gb keyboard"
        Driver          "evdev"
        MatchIsKeyboard "yes"
        Option          "XkbLayout" "gb"
        Option          "XkbModel" "sun_type7_usb"
        Option          "XkbRules" "xorg"
        Option          "XkbOptions" "ctrl:swapcaps"
EndSection
4
  • Is it a Ubuntu server? or you have full Unity setup?
    – user.dz
    Sep 15, 2015 at 8:11
  • 1
    It's a full Unity setup. It's a clean install from the 15.04 64bit installation iso.
    – retrodev
    Sep 15, 2015 at 8:38
  • It could be related to this incomplete bug report: bugs.launchpad.net/ubuntu/+source/xorg/+bug/1216218 , found it from forum.kde.org/…
    – user.dz
    Sep 15, 2015 at 10:58
  • Yeah I saw that. Unfortunately Ubuntu is heading off further and further from the core Unix philosophy of config through text files. All these services reading databases of config options might make things easier for the casual user, but for an experienced Unix used it just causes headaches.
    – retrodev
    Sep 15, 2015 at 11:00

5 Answers 5

2

From your comments to the other answers I can see that you might are not be running a settings daemon. Most DesktopEnvironments (like Gnome, KDE etc.) runs a service for keeping track of every little setting for you! But WindowManagers (like WindowMaker, i3, awesome etc.) usually don't have this feature.

If you are starting a WindowManager from ~/.xsession or other homemade script, then you should set your keyboard settings for that specific session. Setting the keyboard layout can be done with setxkbmap from your Xsession script before the line where you start the WindowManager.

setxkbmap -model sun_type7_usb -layout gb -option ctrl:swapcaps

As a bonus info, you can get all the available models, layouts etc. from these commands:

localectl list-x11-keymap-models
localectl list-x11-keymap-layouts
localectl list-x11-keymap-variants [layout]
localectl list-x11-keymap-options

These informations were primarily found at ArchWiki, where there is some more information about keyboards in general though it may differ a bit from Ubuntu.

2
  • That's what I've been doing so far. So is it correct bevahiour for xorg keyboard settings to be present in the display manager, but not the window manager started by .xsession?
    – retrodev
    Sep 21, 2015 at 8:25
  • Actually I think that it might be the DisplayManager that is to blame, but I'm not sure. I would certainly consider this a correct way to do thinks if you don't want to use some kind of settings-manager. Sep 21, 2015 at 11:29
1
  1. Try edit /etc/default/keyboard

    XKBMODEL="sun_type7_usb"
    XKBLAYOUT="gb"
    XKBOPTIONS="ctrl:swapcaps"
    
  2. To apply, Reboot or run:

    sudo udevadm trigger --subsystem-match=input --action=change
    

Reference: man keyboard

1
  • 2
    That didn't work either unfortunately.
    – retrodev
    Sep 15, 2015 at 9:59
1

If the layout change works on the login screen, but breaks after logging in, it means that the same resources are intercepted by a third-party program. In my case, it was the ibus daemon. It has its own layout settings. I found it by searching among open files by encoding, since I decided that this program should use encoding files:

lsof | grep -i CP1251 | awk '{print $1}' | sort | uniq

(CP1251 is my default locale :) utf-8 in your case) Among browsers, openoffice, pulseaudio a demon ibus was discovered. After deleting it, the layout stopped breaking. (It can also be reconfigured to a non aggressive mode of operation)

0
  • Unity has its own settings daemon that take care of layout setup, which reset any previous Xorg setup.

    1. Check current setting:

      gsettings get org.gnome.desktop.input-sources xkb-options
      
    2. Then add ctrl:swapcaps to it and set it back.

      gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:swapcaps']"
      
    3. Set layout to gb

      gsettings set org.gnome.desktop.input-sources sources [('xkb', 'gb')]
      
  • If it didn't work, disable keyboard plug-in of settings daemon

    gsettings set org.gnome.settings-daemon.plugins.keyboard active false
    

    Reference: Permanently set keyboard layout options with setxkbmap in gnome/unity

BTW, You can use GUI tool instead of command line if you want, look for dconf-editor

3
  • I've removed Unity and am using xdm as my login manager to login to a WindowMaker session via an ~/.xsession file. Does this still apply?
    – retrodev
    Sep 15, 2015 at 9:24
  • @retrodev , Not sure but you may check if gnome-settings-daemon or unity-settings-daemon is runnung
    – user.dz
    Sep 15, 2015 at 9:28
  • 1
    They're not unfortunately.
    – retrodev
    Sep 15, 2015 at 9:29
0

Have you try this:

    gsettings set org.gnome.setting-daemon.keyboard.layout KEY=active VALUE=true

and it might work fine this way.

1
  • I'm not running gnome or lightdm. I'm running xdm and windowmaker.
    – retrodev
    Sep 16, 2015 at 8:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .