Results 1 to 4 of 4

Thread: unable to rebind right alt key with xmodmap

  1. #1
    Join Date
    Feb 2006
    Beans
    14

    unable to rebind right alt key with xmodmap

    I am trying to rebind my right Alt key as a Hyper key, so that I can make own keybindings that won't get in the way of my apps/WM. Unfortunately, I cannot seem to rebind this key.

    After freshly logging in, if I run xev and press my right Alt key, I get this:

    Code:
    KeyPress event, serial 37, synthetic NO, window 0x2200001,
        root 0x13c, subw 0x0, time 50532932, (-1,160), root:(584,211),
        state 0x2000, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
        XKeysymToKeycode returns keycode: 92
        XLookupString gives 0 bytes: 
        XmbLookupString gives 0 bytes: 
        XFilterEvent returns: False
    
    KeyRelease event, serial 37, synthetic NO, window 0x2200001,
        root 0x13c, subw 0x0, time 50533064, (-1,160), root:(584,211),
        state 0x2080, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
        XKeysymToKeycode returns keycode: 92
        XLookupString gives 0 bytes: 
        XFilterEvent returns: False
    But if I run xmodmap to try to rebind the key, it doesn't work:

    Code:
    $ xmodmap -e 'keycode 108 = x'
    Pressing my right Alt key doesn't produce the 'x' character. Pressing my right Alt key inside of xev produces the following:

    Code:
    KeyPress event, serial 50, synthetic NO, window 0x4c00001,
        root 0x13c, subw 0x0, time 51429231, (178,59), root:(184,453),
        state 0x2000, keycode 108 (keysym 0x0, NoSymbol), same_screen YES,
        XLookupString gives 0 bytes: 
        XmbLookupString gives 0 bytes: 
        XFilterEvent returns: False
    
    KeyRelease event, serial 50, synthetic NO, window 0x4c00001,
        root 0x13c, subw 0x0, time 51429452, (178,59), root:(184,453),
        state 0x2000, keycode 108 (keysym 0x0, NoSymbol), same_screen YES,
        XLookupString gives 0 bytes: 
        XFilterEvent returns: False
    I can use xev to find the keycode for my Tab key and rebind it to 'x':


    Code:
    $ xmodmap -e 'keycode 23 = x'
    and then pressing my Tab key results in the 'x' character, but it doesn't work for my right Alt key.

    I've Googled and read the man pages, and I still don't know why I can't rebind my right Alt key. Any ideas?

    Thanks in advance!
    Last edited by noahlt; June 10th, 2010 at 07:10 PM. Reason: mark solved

  2. #2
    Join Date
    Jan 2009
    Beans
    Hidden!

    Re: unable to rebind right alt key with xmodmap

    The process you used works just fine for me to remap my right Alt key. I notice that your right Alt key produces a different symbol than mine without the mapping. Yours produces ISO_Level3_Shift and mine produces Alt_R. This could be significant, but I'm not sure how. Sorry I can't be more helpful.

  3. #3
    Join Date
    Feb 2009
    Location
    San Diego County
    Beans
    42
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: unable to rebind right alt key with xmodmap

    Your Right-Alt key is set to select the third level key rather than as Alt_R as Brandon noticed. Mine was too and I just changed it in "System > Keyboard > Layouts tab > Options > Key to choose third level" to a different key and now it is Alt_R. Maybe this is the problem?

    Best,

    Steve

  4. #4
    Join Date
    Feb 2006
    Beans
    14

    Re: unable to rebind right alt key with xmodmap

    Thanks humbug01! Thanks to Brandon, too, for pointing out that my Alt key wasn't producing Alt_R.

    I went to Keyboard Preferences > Layouts > Layout Options and changed "Key to choose 3rd level" to "Right Alt key never chooses 3rd level". After I restarted my X session, xev shows that my right Alt key produces Alt_R instead of ISO_Level3_Shift, which allowed me to add Alt_R as a Mod3 modifier key using xmodmap.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •