up vote 1 down vote favorite
1

I'd like to switch my CTRL and ALT keys under Linux (to make it more Mac-like). How do I do this?

If it helps, I'm running Ubuntu 9.04.

flag

3 Answers

up vote 2 down vote accepted

First off, try looking in Preferences > Keyboard > Layouts > Layout Options under the Alt/Win key behavior if there is a suitable option there for you.

If that doesn't do it for you these commands would switch left control with left alt (at least with my keyboard).

Xmodmap -e 'keycode 37 = Alt_L  ISO_Prev_Group ISO_Prev_Group NoSymbol ISO_Prev_Group' 
Xmodmap -e 'keycode 64 = Control_L'

To get your keycode, you can run the program xev in a terminal window and press first Control and note the keycode, then Alt to get the keycode.

Good luck!

link|flag
up vote 1 down vote

xmodmap - utility for modifying keymaps and pointer button mappings in X

showkey - examine the codes sent by the keyboard

setkeycodes - load kernel scancode-to-keycode mapping table entries

link|flag
Running showkey produces the error, "Couldnt get a file descriptor referring to the console." Looks like this has happened to a few others on the net...hope it's just my system and not (K)ubuntu's setup. – Nikhil Chelliah Jul 15 '09 at 15:16
@Nikhil Chelliah - showkey and setkeycodes are system level so you'd need to sudo them. – mas Jul 15 '09 at 15:56
@mas: Thanks, that solved it, although I wish the tools had more specific error messages. +1 – Nikhil Chelliah Jul 16 '09 at 9:55
up vote 0 down vote

There's a solution posted on the Ubuntu forums. I used a similar one some time back to reconfigure Caps Lock.

link|flag

Your Answer

get an OpenID
or
never shown

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