Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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

if [ $DISPLAY ]
then
  # Add the 3 lines below to Convert caps-lock into Control
  xmodmap -e 'remove Lock = Caps_Lock'
  xmodmap -e 'keysym Caps_Lock = Control_L'
  xmodmap -e 'add Control = Control_L'

  # and xcape is in Startup Applications
fi

Then go get xcape - you'll need to install the dependencies (see the README) and do make and sudo make install. And then it does what the README says:

xcape runs as a daemon and intercepts the Control key. If the Control key is pressed and released on its own, it will generate an Escape key event.

I'm using it now and it's very nice :)

I guess a modified version could do the shift/parentheses thing as well.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.