1

I am following this1 tutorial about remapping keys in Ubuntu. The tutorial describes how one can remap the CapsLock key using setxkbmap. Currently I only want to test this by disabling the Caps Lock key:

setxkbmap -option "caps:none"

which works fine. However, it does not store the change permanently. After rebooting, the change is lost. The tutorial recommends to use a file /usr/share/X11/xorg.conf.d/10-keyboard.conf and enter a InputClass section:

Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "no,us"
        Option "XkbModel" "pc105"
        Option "XkbOptions" "caps:none"
EndSection

However, on my Ubuntu 16.04 machine there is no file /usr/share/X11/xorg.conf.d/10-keyboard.conf.

After further googling, I got more confused, as there seems to be wide variety of answers and corresponding recommended files to use. For example, these file have been mentioned

  • /usr/share/X11/xkb/symbols/pc
  • /etc/default/keyboard
  • /etc/default/console-setup

What is the correct way to do this on Ubuntu 16.04?

See also:

Edit:

Creating a new file /usr/share/X11/xorg.conf.d/10-keyboard.conf as suggested by @GunnarHjalmarsson in a comment, does not work either. However, I tested now setting the option in /etc/default/keyboard instead:

XKBMODEL="pc105"
XKBLAYOUT="no"
XKBVARIANT=""
XKBOPTIONS="caps:none"

and this seems to work fine! It would be nice if someone could also explain why?

Footnotes:

[1] Hacking Your Linux Keyboard with xkb

  • I suppose that the tutorial meant to say that you can create a /usr/share/X11/xorg.conf.d/10-keyboard.conf file. – Gunnar Hjalmarsson Sep 30 '16 at 21:25
  • @GunnarHjalmarsson Yes of course! Thanks. But unfortunately it did not work. After rebooting, the Caps Lock is still enabled. – Håkon Hægland Oct 1 '16 at 5:48
  • 1
    I was about to suggest /etc/default/keyboard, and then saw that you already had made it work that way. Don't have a good answer why it works other than the file seems to be central for keyboard configuration on Ubuntu. Available options can be found via man xkeyboard-config. – Gunnar Hjalmarsson Oct 1 '16 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.