I'm trying to map LSGT (the key on European keyboards) to "left control" using xkb with no success (under X and ubuntu 18).

I tried the following:

  1. replacing the LSGT line with
    key <LSGT> { [Control_L] };

and adding modifier_keys tag before the block in the body of the layout I use in /usr/share/xkb/symbols/fr (in the bepo section since this is the layout I use)

  1. following roughly the step detailed here and here: more precisely I added the following code at the end of .../xkb/symbols/ctrl
partial modifier_keys alphanumeric_keys
xkb_symbols "lsgt_lctrl" {
    key <LSGT> { [Control_L] };

(the alphanumeric tag is here because I'm not clear wether the tags refer to the key mapping or the actual keys and I guess LSGT is an alphanumeric key I also tried removing it)

the following line in .../xkb/rules/evdev under ! option = symbols

ctrl:lsgt_lctrl = +ctrl(lsgt_lctrl)

and the following line under ! option in evdev.lst

ctrl:lsgt_lctrl Use LSGT as left control 

using dconf editor I added ['ctrl:lsgt_lctrl'] in the xkb options

Then I rebooted, since this didn't work I tried deleting everything in /var/lib/xkb (which contained only a README.compiled file) and rebooting again and it still doesn't work.

I remember using a similar-ish procedure had worked under a previous linux install so I'm confused.

Thank you for reading me, this is my first time asking a question in this type of forum and I'm fairly new to linux so let me know if I'm doing so in a wrong or annoying way.

3 Answers 3


I solved my issue by adding the replace keyword in the first block of code. It now reads

partial modifier_keys alphanumeric_keys
xkb_symbols "lsgt_lctrl" {
   replace key <LSGT> { [Control_L] };

I assume there is another conflicting definition for LSGT elsewhere in xkb (?)

note: since I didn't register the first time around I don't know if I can properly indicate that this is me answering my own question or that the answer does work.

  • Don't worry, it is correctly registered as an answer to your own question. After a minimum waiting time, you can even accept your own answer if no answer you might consider as better has been posted in the meantime.
    – AdminBee
    Commented Jan 24, 2020 at 9:58

I solved similar issue with the following change in /usr/share/X11/xkb/keycodes/evdev

#        <LSGT> = 94;
#        <RCTL> = 105;
        <RCTL> = 94;

After that, the "\&|*", known as LSGT, which occupied place of right control in my case, works as right control. The drawback is that on external keyboard, right control does not work anymore after this change.

So to have LSGT work as LCTL, try the following

#        <LSGT> = 94;
#        <LCTL> = 37;
        <LCTL> = 94;

running setkbdmap -print > somefile.xkb prints the XKB config with macros/directives expanded as indicated in this thread.

if you compare that with the unexpanded setkbdmap -print output, the problems with your config may be more clear. doing this also gives you a file with your keycodes listed in order.

after looking through that config, I found that my XKB macros/directives are not being expanded in order, causing the following lines to be evaluated after my io(swapcaps) and ìo(intl) lines have been included.

    key <LVL3> {
        type= "ONE_LEVEL",
        symbols[Group1]= [ ISO_Level3_Shift ]
    key <LSGT> {
        type= "FOUR_LEVEL",
        symbols[Group1]= [ backslash, bar, backslash, bar ]

also, if you go to Keyboard config (in the KDE system settings module), then under layouts you can generate previews of your layouts. for this situation, the previews generate better output than parsing layouts with xkbcomp /usr/share/X11/xkb/symbols/io $DISPLAY or setxkbmap -config ~/.config/me/xkb/io -print -verbose 10. once you get the preview to generate, then you should see the "< >" symbol on whichever key you mapped/replaced it with.

i'm trying to map key <ESC> {[ LSGT ]} or use replace key with the following script below, while then applying the level5(lsgt_switch) to get an additional modkey -- or at least get an extended range of symbols for LaTeX/Julia...

hidden partial
xkb_symbols "swapcaps" {
    key <ESC> {[ LSGT ]};
    key <CAPS> {[ Escape ]};

xkb_symbols "intl" {

    include "us(intl)"
    include "io(swapcaps)"
    include "level5(lsgt_switch)"

    name[Group1] = "Digimon - US (With Dead Keys)";

    key <SPCE> {[       space, underscore, nobreakspace, nobreakspace   ]};

    //key <TLDE> {[dead_grave, dead_tilde, grave, asciitilde ] };

    key <AE01> {[              exclam, 1,    exclamdown,      onesuperior ] };
    key <AE02> {[                  at, 2,   twosuperior, dead_doubleacute ] };
    key <AE03> {[          numbersign, 3, threesuperior,      dead_macron ] };
    key <AE04> {[              dollar, 4,      currency,         sterling ] };

    //// ...

Some notes on pc104 & pc105 keycodes:

  • the only keycode that the pc104 keyboard lacks is 93, which immediately precedes key <LSGT> = 94. i'm still running into problems. but it's strange this key is even defined there, since the only difference between pc104 and pc105 is the added LSGT key.
  • i can't seem to find the actual pc105 definition, which only seems to exist in $XKB/symbols/pc as symbols.
  • oh and setting your keyboard to a UK or European variant may solve the problem. I need to reboot to see if the pc105 keycodes and uk(intl) symbols together will allow me to map on top of them. Commented Mar 1, 2021 at 4:14

You must log in to answer this question.

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