@jyoseph

Use xmodmap to remap keys on Apple Aluminum Keyboard

Ok, another problem I've been having, and this has been fairly consistent through any Linux distro. I'm an Apple user, therefore I'm used to the Apple keyboard layout. I use Command, not Control. Here's a fix on how to remap your keys so you can still have the luxury of not breaking your fingers to hit the control key.

10.24.2008

In fact, I've used this trick across many different linux distros including PCLinuxOS (one of my favorites thus far, and one my buddy devnet swears by), Kubuntu, Linux Mint and Ubuntu.

First, create a file in your home directory. Browse to /home/yourusername/ and create a file called .xmodmap. Open the file and paste in the following:

remove control = Control_L Control_R keycode 115 = Super_L Super_L keycode 116 = Super_R Super_R add control = Super_L Super_R

Now, open up terminal and type the following:

xmodmap ~/.xmodmap

That will load the new file and your mapping should start to work. Not sure if your computer is different, might be. But hey give it a go.

Oh one thing I forgot, you'll want to add that to a startup script so you don't have to type "xmodmap ~/.xmodmap" every time you reboot your computer. It's different in KDE and Gnome I think. On my Ubuntu box I went to System > Preferences > Sessions which brought up a dialog box. On the "Startup Programs" tab click the "+Add" button. Name it whatever you want but in the command field type xmodmap ~/.xmodmap.

I hope that helps someone out there. If not, I'll have it here to refer back to down the road.

Back Up

Comments

Sergi 10.24.2008
Just two points. To know the keycode of a key just execute xev from the console and press the key, and to know your current mappings, xmodmap -pke also from the console.
jyoseph 10.24.2008
Excellent points Sergi! (your comment slipped right by me)

Also, on Ubuntu 9.04 you can go to System > Preferences > Startup Applications instead of System > Preferences > Sessions.
  • Required fields are marked with an asterisk *

Back Up