0

When I type on the built-in keyboard of my MSI laptop GS75 Stealth 9SF, it seems that the mapping of the backslash key (\|) and the Right alt key are swapped.

This issue persists no matter what keyboard layout or language I choose.

Here is what xev outputs when I push right Alt:

keycode 94 (keysym 0x5c, backslash)
XKeysymToKeycode returns keycode: 51
XLookupString gives 1 bytes: (5c) "\"

And this is the output of me pushing the backslash key:

keycode 108 (keysym 0xfe03, ISO_Level3_Shift)
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:

When I use external USB keyboard, all works properly as expected, so it seems like the SteelSeries keyboard manufacturer messed up key codes? That's what I've thought at first, but then I've realised that it works properly on Windows.


And here is an image of the keyboard layout from LaptopMag's review:


(source: purch.com)

It's those two keys that are on the right side of the spacebar.

Glorfindel
  • 975
  • 3
  • 15
  • 21
jirislav
  • 641

3 Answers3

3

On my MSI laptop there's a "backslash/alt key swap" option on the BIOS/UEFI setup under the "Advanced" tab. You should have it on "Disabled".

Jordi
  • 46
1

I have tried it in my laptop with Right Alt key, which is also 108 keycode for me..

The point I understood from your output is, your Right Alt key with keycode 108 is having modifier ISO_Level3_Shift you can check this to confirm by running simply xmodmap

Exmaple:

pratap@pratap:~$ xmodmap
xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3      
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

pratap@pratap:~$

This means when you combine Right Alt with Shift it should print 4th keysym

So you need to remove the modifier from Right Alt before running

xmodmap -e "keycode 108 = backslash bar"

To remove the modifier from Right Alt, the best way is to use either gnome-tweaks or gsettings

Gnome-Tweaks: enter image description here

gsettings:

gsettings get org.gnome.desktop.input-sources xkb-options

to set the value to none run below command. [Be careful if you get multiple options from above command]

gsettings set org.gnome.desktop.input-sources xkb-options "[]"

enter image description here

1

Try selecting for "Polish(legacy)" keyboard layout it worked for me