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.

I want to:

  1. Turn off capslock when hitting the capslock key
  2. Escape when hitting the capslock key
  3. Behave like ctrl when pressing down the capslock key

What I have in my ~/.Xmodmap:

!Set Capslock to LCtrl
remove Lock = Caps_Lock
remove Control = Control_L
keycode 66 = Control_L
add Control = Control_L

!Set Escape to Capslock
keycode 9 = Caps_Lock
add Lock = Caps_Lock

!Dummy Escape Key for XCape
keycode 254 = Escape

What I have at the end of my ~/.profile:

$HOME/xcape/xcape -e 'Control_L=Escape' # Run xcape after login

Things work mostly as expected with just Xmodmap, and mostly as expected with Xmodmap + $HOME/xcape/xcape -e 'Control_L=Escape' when not run from .profile.

I get some strange behaviors when it runs from .profile; capslock key still toggles capslock in addition to behaving as esc and ctrl. My left ctrl exhibits this exact behavior as well.

Maybe I should be running this from somewhere other than .profile?

Edit: tried running $HOME/xcape/xcape -e 'Control_L=Escape' from xubuntu's menu -> settings manager -> Session and Startup -> Application Autostart with no effect at all.

share|improve this question
    
If anyone is wondering about use case, I use a vim emulator in emacs and it's convenient to have the capslock key behave as both esc and ctrl. It all works well enough with the slight off-behavior of the ctrl key also behaving as esc and having to run the xcape command every time I restart. –  deadghost Jun 10 at 6:09

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.