Just read this seriously obsessive post about customising keyboards and while I'm not going to do everything there, there are a couple of ideas I'd like to nick. In particular he has set up the Caps Lock key so that:
- when pressed and released alone, it is mapped to Esc
- when pressed and held, and a second key is pressed, it is mapped to Ctrl
As he says, this is great for vim users. Is that possible in Ubuntu?
He also does something similar with the right and left Shift keys. When pressed alone they map to ( and ) but if another key is pressed they act as you expect Shift to work.
I found an answer on unix.se at least to the Caps Lock/Ctrl/Esc part.
First remap Caps Lock to an extra Control by putting the following in
~/.profile
Then go get xcape - you'll need to install the dependencies (see the README) and do
make
andsudo make install
. And then it does what the README says:I'm using it now and it's very nice :)
I guess a modified version could do the shift/parentheses thing as well.
On Ubuntu 16.04
1st Option
Caps_Lock as Ctrl
open the file
/etc/default/keyboard
, and changeXKBOPTIONS=""
to:Caps_Lock as Esc
install xcape with
create
.xsessionrc
at the home directory (or edit if it already exist)add the following line to
~/.xsessionrc
Note
for a full list of all the options that you can set in (1), check the
! options
section in2nd Option
you can use the following script to get the same behavior in a session.
e.g.
custom_capslock
in~/.local/bin/
make it executable
add it to Startup Applications, by adding the FULL PATH of the script to Command field.
e.g
/home/yourname/.local/custom_capslock
PS: if you want to use systemd or
/etc/rc.local
instead of "Startup Applications", make sure that your script didn't get overridden by other system services