32

I've seen a number of questions that point to a GUI menu to remap caps lock, but that menu seems to be gone in 14.04. Am I just not finding it, or is it really gone? I know you can use xkbmap to remap it, but I'm not really sure how to make that persist.

Edit

I've tried the suggestions on the accepted answer for this question, but nothing seems to be working. From what I can tell, the .xinitrc file doesn't ever seem to be sourced. Is there some other work around that might fix this for me?

4 Answers4

27

You should edit the file /etc/default/keyboard and modify the XKBOPTIONS setting.

For example to map capslock to control set XKBOPTIONS=“ctrl:nocaps” (source: Archlinux wiki

log out and log in again for changes to impact your system.

ALM
  • 55
dwaynemac
  • 463
  • 4
    huge thanks mate, all this GUI nonsense with installing packages is a pain in the butt, and most ways either didn't work, or worked in some contexts but not others. – alexakarpov Apr 23 '15 at 04:45
18

Finally found a GUI answer, after much Googling: How do I swap Escape and Caps Lock in 14.04? (Looks like your question was phrased better and so showed up much higher in my search results.)

From the linked answer:

Install the GNOME Tweak Tool (gnome-tweak-tool), under the Typing tab there is an option to swap Esc with Caps Lock. This worked for me in Ubuntu 14.04.

Strangely, the tool window's background didn't fill in for me, so I had to open up a gedit window behind it just to view the text.

Hope that helps! Even with the buggy window, it was much more pleasant than messing with xkb settings directly.

  • This doesn't appear to work under XUbuntu 14.04. – Paul Price Aug 05 '14 at 21:18
  • 1
    I got this to work in Ubuntu 14.04. The window background bug is really bad - hard to believe nobody has fixed that. If you want to swap CTRL and CAPS, that is done under "Ctrl Key Position", and is not available under "Caps Lock Behavior". I was puzzling over why every other option for the caps lock was listed except for swapping with CTRL when I finally noticed the separate setting for CTRL. – tim11g Feb 14 '15 at 18:02
  • Unfortunately GNOME Tweak Tool seems quite bugged when used in Unity. The solution using /etc/default/keyboard seems more appropriate (I tried both). – marcelocra Mar 31 '16 at 23:56
  • gnome-tweak-tool works well under Ubuntu 16.04. I like that changes are effective immediately with no restart or anything. – dinosaur Sep 26 '16 at 23:28
8

In my case the following worked to disable capslock in Ubuntu 14.04:

setxkbmap -option caps:none

Startup Applications > Add > Name: Disable Capslock > Command: setxkbmap -option caps:none > Add.

Restart and capslock is disabled.


To remap capslock to escape key:

setxkbmap -option caps:escape
Andrzej Rehmann
  • 189
  • 1
  • 6
MC Basstard
  • 468
  • 5
  • 8
3

After searching around enough, I think I finally found that magic google incantation to find the answer. Here's the post that solved my problem: Make setxkbmap preferences being set at startup. I just followed the instructions in the accepted answer and added 'ctrl:nocaps' to the xkb-options. I really hope they just bring back the settings GUI to change this....