1

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?

1
  • Take a look at This, it might help.
    – Mitch
    Aug 3, 2013 at 9:10

1 Answer 1

1

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.

6
  • 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?
    – Will Hua
    Aug 3, 2013 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, 2013 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)
    – Will Hua
    Aug 3, 2013 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, 2013 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
    – Will Hua
    Aug 5, 2013 at 15:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .