Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using Archlinux. When I program , I like to swap the Escape and Caps Lock.

I know that gnome can do this job. But Gnome 3.6.2 in the Archlinux can not find this.

So i use the xmodmap and create a file : ~/.xmodmap

  clear Lock
  keysym Caps_Lock = Escape
  keysym Escape = Caps_Lock
  add Lock = Caps_Lock

when i run:

  xmodmap ~/.xmodmap

it works well.

But it can not work automatic when i login the gnome, even though i add xmodmap ~/.xmodmap to ~/.xprofile.

Am I doing something wrong ? How can I solve this issue?

share|improve this question

migrated from stackoverflow.com Dec 16 '12 at 7:57

This question came from our site for professional and enthusiast programmers.

4 Answers 4

Try to add following command into your .bashrc file

xmodmap ~/.xmodmap

For example I keep the following line in my .bashrc file

xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'

which adds an extra escape instead of Caps Lock.

share|improve this answer

Avoid using xmodmap as its another daemon that has to run. Use setxkbmap, which can be found in the extra/xorg-setxkbmap package. See a similar question for how to automatically have this start when you start GNOME, but use the caps:swapescape option instead. For example, if you are using startx and ~/.xinitrc, add the following to it:

setxkbmap -option caps:swapescape
share|improve this answer

The file you should create is ~/.Xmodmap with the capital X. Depending on which login manager (gdm, xdm, etc...) you use the ~/.Xmodmap should be automatically loaded, if this isn't happing, as it seems in your question, you can edit your ~/.xsession and ~/.xinitrc files and add these line to force loading your ~/.Xmodmap:

 [ -f ~/.Xmodmap ] && xmodmap ~/.Xmodmap
share|improve this answer

I think you should create a file with name ~/.Xmodmap (note the big X). As I see in /etc/gdm/Xsession gdm loads ~/.Xmodmap if it exists so you don't need ~/.xprofile or similar hack :)

share|improve this answer

Your Answer

 
discard

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