Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to replace my alt keys with my control keys and then place the alt keys on the two menus keys besides the control key. The problem is that the key right of my right alt is actually the print screen button (I have a lenovo thinkpad t430) so I need to adjust this from the config file

I edited the symbols/us file and added severel adjustments such as adding the following:

key <LALT> {[Control_L]};

into the English (US) keyboard (which I am currently using).

The change does not occur on my laptop. What am I doing wrong?

share|improve this question
    
Take a look at This, it might help. –  Mitch Aug 3 '13 at 9:10
add comment

1 Answer

up vote 0 down vote accepted

Why not use Xmodmap for what you are doing? A .xmodmaprc to swap alt and control would look like this:

remove control = Control_L
remove control = Control_R
remove    mod1 = Alt_L
remove    mod1 = Alt_R

! make alt keys to control
keycode     64 = Control_L
keycode    108 = Control_R

! and control keys to alt
keycode     37 = Alt_L
keycode    105 = Alt_R


add    control = Control_L Control_R
add       mod1 = Alt_L Alt_R

Where 64 is the keycode of AltL. Your keycodes may vary, you can find them out with xev Start it and press the AltL key to see the keycode

$ xev
...
KeyPress event, serial 24, synthetic NO, window 0x2c00001,
    root 0xb9, subw 0x0, time 599529285, (-70,692), root:(572,713),
    state 0x10, keycode 64 (keysym 0xffe3, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False
...

You apply it with

$ xmodmap ~/.xmodmaprc

I remapped my alt and control keys as well. You can take a look at my xmodmap.

share|improve this answer
    
Hi I took your advice and used Xmodmap per the instructions on this links askubuntu.com/a/24930/180964 (sorry I didn't quite understand yours, I'm new to this). It's mapped correctly per xev, when I press a button down the action says it is correct, however in my webbrowser will not register these changes. I changed my Super_L key, and the new one works, however the new alt-tab does not. Why is this? –  William Bing Hua Aug 3 '13 at 16:03
    
Nothing to be sorry for. Can you post your xmodmap config? So xev says alt is mapped to that key, but it won't work with alt-tab? Or what exactly is the issue? –  ahilsend Aug 3 '13 at 16:56
    
.Xmodmap. The basic problem is that only one of the keys is working (Super_L), which I binded to the original left control key. It's weird, the key still has the control functionality in the browser, yet acts as Super_L on the desktop (it pulls up that shortcut cheat sheet if you hold it down long enough). I want keycode 64 to be Control_L and keycode 133 to be Alt_L. I also want 108 to be Control_R and 107 to be Alt_R. The functionalities of these keys aren't working (such as alt-tab) –  William Bing Hua Aug 3 '13 at 18:12
    
I see :/ .. Now there I have to strongly disagree with the other answer. You DO NOT need all keycodes in your xmodmap config. It makes it hard to read and maintain, plus is missing important things for mod-keys. Only put changes into the xmodmap config. No need to explicitly mention the other keys. They will remain what they are. What you seem to be missing are the changes to the mod keys. You need to tell xmodmap that previous control/alt keys are no longer control/alt keys. That's what the first lines in my example do. That has to come first! At the end you need to ad the new keys to alt .. –  ahilsend Aug 3 '13 at 19:12
    
When you type the remove/add portions you type remove control. Where can I find a mapping of all the keys? Or can I just replace it with the keycode? I need to remove/add the printscreen key –  William Bing Hua Aug 5 '13 at 15:10
show 1 more comment

Your Answer

 
discard

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.