Problems with Thinkpad T460 keyboard and Super/Windows/PrtScr keys

I’ve been using Manjaro for a while on my Thinkpad T460, which I typically use in “desktop mode” i.e. plugged into an external keyboard and monitor.

I recently noticed that an issue with the built-in (GB/UK layout) laptop keyboard: the Super/Windows keys don’t function properly.

This is particularly annoying as I use i3wm and have mapped the Super keys to mod4 i.e. the modifier/leader keys that allow me to run window switching and moving commands, as well as launch programs.

This change must have happened in the last month or so, and I’ve done a couple of system upgrades since then. I’m using kernel version 6.1 (6.1.106-1-MANJARO), and the keyboard configuration I’ve been using is the Lenovo (previously IBM) | IBM ThinkPad R60/T60/R61/T61 default variant, which I had found was the closest layout to the one on my laptop.

I’ve checked using xev: the Right Super/Win/PrtScr is being detected when I press it, but the Left Super/Win key is not. I don’t dual-boot, so there’s no obvious way for me to check if this is a mechanical fault with the Left Super key.

Does any one have a working setup for the T460 keyboard?

One important detail: since my external keyboard has a different (US) layout to the built-in one (UK/GB), I have a keybinding to which updates .Xmodmap. This is what .Xmodmap looks like normally:

remove lock = Caps_Lock
keysym Caps_Lock = Escape

When i3 starts up it runs

exec --no-startup-id /usr/bin/xmodmap -e "add mod4 = Print"

And then the layout switch is implemented in my i3config via:

set $keyboard_layout Keyboard Layout: (e) UK, (a) US
mode "$keyboard_layout" {

bindsym e exec --no-startup-id "setxkbmap gb ; /usr/bin/xmodmap ~/.Xmodmap; /usr/bin/xmodmap -e \\"add mod4 = Print\\"; ", mode default
bindsym a exec --no-startup-id "setxkbmap us ; /usr/bin/xmodmap ~/.Xmodmap", mode default

# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Shift+z mode "$keyboard_layout"

(i.e. so $mod+Shift+z creates a menu which lets me select which layout I want.)

Running setxkbmap -print -verbose 10 when in the US layout gives:

Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      thinkpad60
layout:     us
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+inet(evdev)
geometry:   thinkpad(60)
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)"	};
        xkb_types     { include "complete"	};
        xkb_compat    { include "complete"	};
        xkb_symbols   { include "pc+us+inet(evdev)"	};
        xkb_geometry  { include "thinkpad(60)"	};
};

And in the UK/GB layout it produces:

Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      thinkpad60
layout:     gb
variant:    intl
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+gb(intl)+inet(evdev)
geometry:   thinkpad(60)
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)"	};
        xkb_types     { include "complete"	};
        xkb_compat    { include "complete"	};
        xkb_symbols   { include "pc+gb(intl)+inet(evdev)"	};
        xkb_geometry  { include "thinkpad(60)"	};
};

My guess is that it’s hardware, test with evtest (not installed by default), if it doesn’t show up there then it will be hardware.

Make sure there’s nothing under the key preventing it from being pressed properly.

Hmm … evtest is not picking up the Left Super key when I press it, but is picking up the Right. So maybe there is damage. I guess I have to find a layout that allows the Right Super key to be detected.

If it helps, you can apply a different layout for each keyboard at the same time using setxkbmap.

-device device
               Specifies the numeric device id of the input device to be updated with the new keyboard layout. If not specified, the core keyboard device of the X server is updated.

xkbcomp can also do it, but this dumps/loads the final config to/from file, you’d have to dump it, edit if necessary, and then use that file.

       -i deviceid
               If source or destination is a valid X display, load the keymap from/into the device with the specified ID (not name).

Both methods are more versatile than xmodmap (which has been deprecated for a decade or more, though of course it still works).

All three are only temporary (~/.xinitrc loads the xmodmap config on login though), so you’d have to use a systemd user service (or similar) to load it on login, and if the external keyboard gets reconnected then a udev rule can reapply the layout.

You can get the id from xinput, however it changes when reconnected or on reboot etc, so to automate it you’d have to grep or awk the output from xinput for the id based on the name.

EDIT:

You can copy and edit your layouts for setxkbmap (they’re in /usr/share/X11/xkb/symbols), or if using xkbcomp dump them and edit. The latter may be easier, at least to figure out what’s like, as the config is spread across a set of hierarchical files in a number of directories.

https://wiki.archlinux.org/title/X_keyboard_extension

1 Like

Thanks! That does look useful. I’ll try to see if I can implement that soon.

1 Like

Anything in the symbols section can be done in a keyboard layout, eg. gb (except for defining F13-F18 and F20-F23, and anything else in the evdev section of the inet file). Other sections may need xkbcomp (otherwise updates will overwrite any changes).

For remapping CapsLock to Escape you can use an option. If you still need to remap mod4 there are also some options which may work for you, otherwise you should be able to do it in a custom layout:

sudo cp /usr/share/X11/symbols/gb{,_mine}

# add one of these to the bottom of the basic section/layout
# that's the top section
modifier_map Mod4 { <RWIN> };
modifier_map Mod4 { <PRSC> };

# if you need to use PRSC then you may need to redefine 
# that key so it doesn't get used elsewhere, but that may 
# mess up switching to ttys, so maybe pick a different key

# make a script to get the id and apply the layout
# using something like this
setxkbmap -layout gb_mine -option caps:escape -device $id

# use a systemd user service to run the script on login

If you want to use the layout in the GUI, you can call it custom, but you can only have one like that.

I think that’s all your config covered. If you need help, let me know.

EDIT:

To get a list of options:

localectl list-x11-keymap-options

Thanks. I’m not sure I can play around with this until at least this weekend, but that’s very helpful. My current setup (prior to the Super key apparently failing) seemed to work well for me but I do like to clean things up and make them robust to any unexpected changes/deprecations in the future.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.