How do I disable the left CTRL on Ubuntu 13.10?

Actually I can do it already. All I need to run is

xmodmap -e "keycode 37 = "

The problem I have is this only works if I run it from the terminal after my machjine has booted. I really want this run on bootup.

I've tried including the command in a few places:

  • /etc/rc.local
  • ~/i3/config (I use the i3 window manager)

None of them work.

Any help greatfully recieved :)


Based on this discussion, I think this should work:

  1. Create ~/.Xmodmap file with content:

    keycode 37 = 
  2. Create ~/.xinitrc with content:

    # load custom map
    xmodmap ~/.Xmodmap
  3. Make ~/.xinitrc executable:

    chmod +x ~/.xinitrc

Normally, the clean solution to do this kind of thing is to use the keyboard settings of your desktop manager or window manager. But I'm not sure if i3 really has such setting or not. It looks like an interesting window manager, I might try it soon and come back to this if I find a better solution.

  • +1 for the .Xmodmap but the OP uses the i3 window manager, it's not a desktop environment so I doubt it will have this kind of setting. – terdon Jan 14 '14 at 12:13

The thing about xmodmap is that it only pertains to programs running under X; it doesn't affect e.g. the console or a non-X window manager.

In order to remap the keyboard on an earlier level, loadkeys is what you want. It uses the keymaps (usually in /lib/kbd/keymaps/) corresponding to the physical keyboard you're using. Usually you set this up when installing the system so that it uses a map appropriate to your keyboard.

I've not actually done this recently, but here's how it should work if I've got it right:

1 First, dump the current keymap to a file:

dumpkeys > /etc/sysconfig/localkeymap.map

2 Take a backup of that file in case something goes wrong here.

3 Edit that file to change what you want changed, e.g. keycode 37 =.

4 Verify that it works with loadkeys /etc/sysconfig/localkeymap.map

5 If it works as expected, add the loadkeys command to a suitable start script. If it doesn't work, use loadkeys on the backup file you created in step 2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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