1

The Lenovo "Enhanced Performance" USB keyboard has some useful quick start hotkeys in the top row. Strangely, on my Fedora 26 system with XFCE, some of these keys work but others don't -- without any obvious logic.

Here is the situation of which keys work and which keys don't:

Fedora XFCE: Some Hotkeys on Lenovo keyboard work, and some don't

How to get the remaining hotkeys (spreadsheet, lock desktop) to work?

In principle, hotkeys can be configured in two places: Using xfwm4-settings and xfce4-keyboard-settings, depending on what functionality is desired. There, I can configure applications that launch for the keys marked in green - but not for the keys marked in red (the dialog simply does not register a keypress).

Diagnosis so far

Following the Arch hotkey article, I verified that:

  • with evtest all hotkey presses are registered correctly, including for the buttons marked in red above

  • with xev only the keys marked in green are registered.

So, for some of the keys, the keypress is lost somewhere in the stack after evtest and before xev.

The problem appears to be related to the fact that X11 does not support key codes > 255

Here are the problematic keys:

Event code 421 (KEY_WORDPROCESSOR)
Event code 423 (KEY_SPREADSHEET)

How can I fix this?

3

These keys don't work in the default configuration because they are mapped to key codes > 255. For historical reasons, X11 limits key codes to the range [8, 255] and this is really difficult to fix.

The workaround is to remap the key codes to the ranges below 255 which are still free, as shown in the answer linked above.

Get all hotkeys of Lenovo Enhanced Performance USB keyboard to work on Fedora

Create a new file /lib/udev/hwdb.d/61-keyboard-custom.hwdb (the name is important: default key mapping is in the 60-keyboard.hwdb file and we want to override it), with this content

evdev:input:b0003v04B3p301B*
 KEYBOARD_KEY_90004=prog2
 KEYBOARD_KEY_90005=prog3

This rewrites the word processor and spreadsheet keys (KEY_WORDPROCESSOR and KEY_SPREADSHEET) to the keys prog2 and prog3 which are in the allowed range for X11.

Then run

udevadm hwdb --update
udevadm trigger --sysname-match="event*"

and verify with evtest that the two keys work now.

Now it is possible to use XFCE Keyboard Settings to assign programs to these keys.

Bonus: If application is already running, focus on its most recently used window

The desired behaviour of the hotkey - for me - is to either switch back to the most recently used window of the application (if it is already running), or else start the application new and focus on it. This is easy to to do with the shell script in this answer

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.