0

I want to remap key on my (lenovo) keyboard. I want to have Insert under AltGr key.

My keyboard

For example, I have RIGHT CTRL under END button on the keyboard.

key  <END> {    [  Control_R   ]   }; 

I thought that LVL3 or MDSW is responsible for mapping of AltGr,

    key <LVL3> {        [ Insert        ]       };
    key <MDSW> {        [ Insert        ]       };

but it doesn't work.

My XKB configuration /usr/share/X11/xkb/symbols/pc

default  partial alphanumeric_keys modifier_keys
xkb_symbols "pc105" {

    key <ESC>  {    [ Escape        ]   };

    // The extra key on many European keyboards:
    key <LSGT> {    [ less, greater, bar, brokenbar ] };

    // The following keys are common to all layouts.
    key <BKSL> {    [ backslash,    bar ]   };
    key <SPCE> {    [    space      ]   };

    include "srvr_ctrl(fkey2vt)"
    include "pc(editing)"
    include "keypad(x11)"

    key <BKSP> {    [ BackSpace, BackSpace  ]   };

    key  <TAB> {    [ Tab,  ISO_Left_Tab    ]   };
    key <RTRN> {    [ Return        ]   };

    key <CAPS> {    [ Caps_Lock     ]   };
    key <NMLK> {    [ Num_Lock      ]   };

    key <LFSH> {    [ Shift_L       ]   };
    key <LCTL> {    [ Control_L     ]   };
    key <LWIN> {    [ Super_L       ]   };

    key <RTSH> {    [ Shift_R       ]   };
    key <RCTL> {    [ End           ]   };
    key <RWIN> {    [ Super_R       ]   };
    key <MENU> {    [ Menu          ]   };

    // Beginning of modifier mappings.
    modifier_map Shift  { Shift_L, Shift_R };
    modifier_map Lock   { Caps_Lock };
    modifier_map Control{ Control_L, Control_R };
    modifier_map Mod2   { Num_Lock };
    modifier_map Mod4   { Super_L, Super_R };

    key <LVL3> {        [ Insert        ]       };
    key <MDSW> {        [ Insert        ]       };
    modifier_map Mod5   { <LVL3>, <MDSW> };

    key <ALT>  {    [ NoSymbol, Alt_L   ]   };
    include "altwin(meta_alt)"

    key <META> {    [ NoSymbol, Meta_L  ]   };
    modifier_map Mod1   { <META> };

    key <SUPR> {    [ NoSymbol, Super_L ]   };
    modifier_map Mod4   { <SUPR> };

    key <HYPR> {    [ NoSymbol, Hyper_L ]   };
    modifier_map Mod4   { <HYPR> };
    // End of modifier mappings.

    key <OUTP> { [ XF86Display ] };
    key <KITG> { [ XF86KbdLightOnOff ] };
    key <KIDN> { [ XF86KbdBrightnessDown ] };
    key <KIUP> { [ XF86KbdBrightnessUp ] };
};

hidden partial alphanumeric_keys
xkb_symbols "editing" {
    key <INS> {
    type= "PC_ALT_LEVEL2",
    symbols[Group1]= [ Print, Sys_Req ]
    };
    key <SCLK> {    [  Scroll_Lock      ]   };
    key <PAUS> {
    type= "PC_CONTROL_LEVEL2",
    symbols[Group1]= [ Pause, Break ]
    };
    key <HOME> {    [  Alt_L        ]   };
    key <PRSC> {    [  Home         ]   };
    key <PGUP> {    [  Prior        ]   };
    key <DELE> {    [  Delete       ]   };
    key  <END> {    [  Control_R        ]   };
    key <PGDN> {    [  Next         ]   };

    key   <UP> {    [  Up           ]   };
    key <LEFT> {    [  Left         ]   };
    key <DOWN> {    [  Down         ]   };
    key <RGHT> {    [  Right        ]   };
};

Result from xev on pressed AltGr key

KeyRelease event, serial 37, synthetic NO, window 0x3a00001,
    root 0xf5, subw 0x0, time 652866, (315,347), root:(1186,806),
    state 0x80, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 92
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

Could someone give me some advice, which key in my pc file I should change?

  • Can you please explain in clear English what you want to achieve? Which key is it you want to use for accessing third and fourth level symbols instead of <AltGr>? – Gunnar Hjalmarsson Nov 11 '17 at 17:47
  • Updated. I have physical button AltGr and I want to have action 'Insert' after press AltGR. – kukulam Nov 11 '17 at 18:53
  • Ok.. I suppose you don't use a keyboard layout where level 3 is needed then. I think the physical key AltGr is named RALT, so maybe just set RALT in the pc symbols file. See also the level3 symbols file. – Gunnar Hjalmarsson Nov 11 '17 at 19:00
  • RALT tested, doesn't work. – kukulam Nov 11 '17 at 19:14
  • 1
    i'd strongly recommend adding this as a new xkb option rather than changing an existing layout. i expect @GunnarHjalmarsson is right, that <RALT> is the proper key name. <LVL3> and <MDSW> are virtual, not physical, keys; see the .../symbols/level3 and .../symbols/altwin files to compare how <RALT> is defined as AltGr vs plain Alt. – quixotic Nov 11 '17 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.