Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created the following ~/.Xmodmap file as per this answer.

keysym Delete = Menu
keysym Menu = Delete

clear Lock
keycode 0x42 = Escape

In other words, swap Delete and Menu, and make Caps Lock an additional Escape.

The next time I logged in, Ubuntu asked me if I wanted to load ~/.Xmodmap as expected. I loaded it, but nothing happened (either then or on subsequent logins). If I manually run xmodmap ~/.Xmodmap, it works as expected.

I know that this worked early in the 10.10 beta, but it's failing on my fresh 10.10 install. I haven't tried in on anything earlier than 10.10. Any ideas?

Edit: I put some debugging statements in /etc/gdm/Xsession to make sure ~/.Xmodmap was loading, and everything magically started working. I didn't change anything except adding some echos, and it's still working now that I reverted my changes and restarted again. Strangest thing I ever saw.

One thing I realized is that the "remap Caps Lock to Escape" part of the Xmodmap was always working. It was just the Delete/Menu swap that failed. I'll leave this question open for now in case anyone else has the same problem, since I don't actually know why the problem stopped.

share|improve this question
I'm experiencing this same problem myself, been driving me nuts. If I figure out the cause I'll be sure to post an answer. – Jorge Israel Peña Feb 16 '13 at 23:30

I know it's silly but as a workaround you could just autostart xmodmap ~/.Xmodmap.

Also you could check /etc/gdm/Xsession for the line usermodmap="$HOME/.Xmodmap" and if it isn't there just append it at the end of the file. If you're the only user of the system just put your changes into /etc/X11/Xmodmap.

share|improve this answer
How do you "autostart" commands? – miguel.martin Jul 21 '14 at 14:50

Here is, perhaps a better answer then:

You may have to tweak it a little bit to work for you but the instructions are all there.

share|improve this answer
This instructions are for KDE, but if I look at the Gnome equivalent (/etc/gdm/Xsession), the lines that link says to add are already in it. – Matthew Pirocchi Oct 15 '10 at 14:16

Perhaps you have a syntax error in your ~/.Xmodmap file?

Try running:

$ xmodmap ~/.Xmodmap

That should fire an error if there are any.

share|improve this answer

I had the same weird problem, trying to start up my Xmodmap while logging in my session (ubuntu 13.04). I finally made it work with a .xinitrc file in my Home folder where I put my command, but with absolute paths to it, that is:

/usr/bin/xmodmap /home/MYNAME/.Xmodmap

Then I had to reboot (not just relog) so that it would be executed.

share|improve this answer
This does not work under Ubuntu 14.04, for me. – miguel.martin Jul 21 '14 at 14:44

Your Answer


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.