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

Since upgrading to 11.10, xmodmap seems to be working nowhere near as well. I would like to be able to run xmodmap after unlocking a locked screen, as it doesn't work. I have to run it from a terminal (twice). I don't want Caps_Lock or Menu keys after I log in.

Preferably, I would like xmodmap to go back to being useable. It doesn't run automatically at startup anymore like it used to. I have a script at startup that has to run it several times before it actually does things. Here is my .xmodmaprc file; hopefully somebody will be able to find something wrong:
clear mod1
clear mod3
clear mod4
clear lock
keycode 66 = Hyper_L
remove lock = Hyper_L
add mod3 = Hyper_L
keycode 133 = Alt_L
add mod1 = Alt_L
keycode 64 = Super_L
add mod4 = Super_L
keycode 135 = Super_R
add mod4 = Super_R
keycode 118 = Multi_key

Meanwhile, if fixing this file doesn't fix the problems I'm having, I would like to know how to run xmodmap after resuming from suspend or unlocking from a locked screen.

share|improve this question

I am also having this problem on 11.04. This was not always the case -- it just started happening to me some day, so my best guess is that it was due to some sort of software update.

Nevertheless, it is extremely irritating. I found this thread, which suggests that you can add a script /etc/acpi/resume.d/ that runs on wakeup to invoke xmodmap.

Though someone else suggested that this bug may not get fixed and that you may be forced to use the GUI. Because my desired remapping is pretty simple (I just want to remap Caps Lock to Control), that's what I did. This was actually tricky to find, as I had to:

  • Find the Keyboard GUI app
  • Choose the Layouts tab
  • Click the Options button
  • Expand the "Ctrl key position" header because the desired option was not under "Caps Lock key behavior"
  • Check the "Make Caps Lock an additional Ctrl" box

Admittedly, if you're a long-time .Xmodmap user, this is pretty annoying, but it's better than running xmodmap manually every time you log in.

share|improve this answer
Can I get an example of such a script? – Arild Mar 6 '14 at 20:26

You need to change the name of your xmodmap file to ~/.Xmodmap

That's the name of the file which Ubuntu looks for which gets processed by xmodmap each time you start an X session.

share|improve this answer
Could you supply some kind of source reference for that statement? It has no effect in my particular case... – Arild Aug 29 '14 at 19:18

It seems xmodmap support is being phased out:

xmodmap support has been dropped in GNOME3 which deprecate that bug report, closing it

(from Bug #289781 on xserver-xorg-input-evdev)

The graphical configuration Tweak tool might offer the settings you need. You can install it with apt-get install gnome-tweak-tool and use the tab Typing to configure some common keyboard tweaks. (The same settings used to be in the standard System Settings before Ubuntu 12.10).

share|improve this answer

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.