How do I make the Caps Lock key work just like another Shift key?
There are loads of questions here about reassigning it, or having it launch a custom command. I just want it to work like another Shift key. I don't want any other keys to change what they do, just that one.
Keyboard Layout/Caps Lock key behavior won't do it, I don't understand how to remap it in CCSM.
I'm using a UK keyboard now but I learned to type on a US keyboard, the smaller left Shift key is DRIVING ME NUTS.
Expanding on @Zacharee1 answer:
make a backup with
cp /usr/share/X11/xkb/symbols/pc ~/pckeybak
then edit with
gksu gedit /usr/share/X11/xkb/symbols/pc
or your favorite editor.Find the line (22) that says:
key <CAPS> { [ Caps_Lock ] };
and change it to
key <CAPS> { [ Shift_L ] };
and the line (36) that says:
modifier_map Lock { Caps_Lock };
and change it to
//modifier_map Lock { Caps_Lock };
(which should comment it out in effect disabling the locking)Testing indicates that the Num Lock still works as expected. Further testing indicates that the keyboard indicator lights appear to be a bit dyslexic in 16.04 on even an unmodified system. Scroll Lock indicator on at login but Scroll lock off and Num Lock light off, but Num lock on. Tapping the left Ctrl key seems to resolve this behaviour and I'm not sure if it's related to my use of a KVM switch (which is possible)
Note: Further testing shows that the NumLock indicator light is flaky even without a KVM switch and has to be tapped twice to get back in sync with NumLock If you always leave it on you can ignore the light or if it bothers you you can tap it twice to get it back in sync. Why this occurs is likely a basis for a new question...
Another simple solution to your original problem would be to simply obtain an inexpensive US keyboard and use the US keyboard mapping.
Sources: @Zacharee1 answer and analysis of
/usr/share/X11/xkb/symbols/pc
and trial and error testingYou can get there by adapting How to change CapsLock key to produce “a”? (for example).
Remove the
Lock
(= Caps Lock) modifier from the Caps Lock key, and declare that this key sends theShift_L
keysym.Alternatively, you could remove the
Lock
modifier and add theShift
modifier.Either way, these lines go into the file
~/.Xmodmap
. Test by loading it withxmodmap ~/.Xmodmap
; the file is read automatically when you log in under the default environment (or at least it was in the Gnome days).Ignoring my previous attempts at answering that failed, I found something that turns capslock completely into left shift. No toggling, I think it's persistent, and it's pretty simple.
First, I'd recommend making a backup, before I introduce how to change it.
Run
sudo cp /usr/share/X11/xkb/symbols/pc ~/pckeybak
Now that there's a backup, let's get to the editing.
Use your favorite text editor to edit this file as root:
Find the segment that looks like this (it's near the top, line 22 for me):
edit
to be
instead. (The
Caps_Lock
afterShift_L,
may be unnecessary.)Restart your display manager (usually
sudo service lightdm restart
) and capslock will now be left shift. (Note: My test machine uses GNOME, so I had to restartgdm
. However, that caused some weird flickering in the fallback TTY, andgdm
never restarted. I had to completely reboot.)This one I was actually able to test, and can confirm it works.
Adapted from Permanent xmodmap in Ubuntu 13.04
For 14.04
A one-liner:
BUT, in the unexpected case
66
is not the correct keycode, first runxev
in console and press CapsLock. Then you will see something like:The correct keycode is the one indicated in the
XX
.