How to get Zoom slider on Microsoft keyboard recognized by X11

If you are using Microsoft Natural Ergonomic Keyboard 4000 as I do you may wondered how to get that zoom slider in a middle to be useful. Thanks to Hans de Goede there is a solution.

There is one new file and changes to other needed. First we need to instruct udev to remap some keys for us. Create /lib/udev/hwdb.d50-msoffice-keyboard-xorg.hwdb file with this content:

# classic msoffice keyboard
keyboard:usb:v045Ep0048d*dc*dsc*dp*ic*isc*ip*in01*
 KEYBOARD_KEY_0c0184=documents          # KEY_WORDPROCESSOR to KEY_DOCUMENTS
 KEYBOARD_KEY_0c0186=finance            # KEY_SPREADSHEET   to KEY_FINANCE
 KEYBOARD_KEY_0c018e=chat               # KEY_CALENDAR      to KEY_CHAT
 KEYBOARD_KEY_0c01a3=nextsong           # KEY_NEXT          to KEY_NEXTSONG
 KEYBOARD_KEY_0c01a4=previoussong       # KEY_PREVIOUS      to KEY_PREVIOUSSONG
 KEYBOARD_KEY_0c01ab=search             # KEY_SPELLCHECK    to KEY_SEARCH

# Microsoft Natural Ergonomic Keyboard 4000
keyboard:usb:v045Ep00DB*
 KEYBOARD_KEY_0c01ab=search             # KEY_SPELLCHECK    to KEY_SEARCH
 KEYBOARD_KEY_0c022d=scrollup           # KEY_ZOOMIN        to KEY_SCROLLUP
 KEYBOARD_KEY_0c022e=scrolldown         # KEY_ZOOMOUT       to KEY_SCROLLDOWN

In Fedora rawhide I also needed to edit 60-keyboard.hwdb file (same directory) to disable some definitions:

# Microsoft Natural Ergonomic Keyboard 4000
#keyboard:usb:v045Ep00DB*
# KEYBOARD_KEY_c022d=zoomin
# KEYBOARD_KEY_c022e=zoomout

Now update of hwdb is needed:

sudo udevadm hwdb --update
sudo udevadm control --reload

And the only thing left is replugging the keyboard (or system reboot). As a bonus you get XF86Search button instead of non-working Spell (F10). Those who use Microsoft Office Keyboard (old one with scroller on left side) will get all keys working as well but they also need 3.14 kernel to get all recent fixes.

And why all that is needed at all? Simple — Xorg is still sitting in 80s when it comes to handling keyboard and ignores all keycodes with >8bit values. I hope that Wayland does not follow that way and does/will just take whatever system under is telling about input devices.

computers fedora ubuntu