Skip to content

Instantly share code, notes, and snippets.

@Bizzaro
Created April 11, 2026 17:26
Show Gist options
  • Select an option

  • Save Bizzaro/f4f6e48e4537013b4239205fd0aabfa0 to your computer and use it in GitHub Desktop.

Select an option

Save Bizzaro/f4f6e48e4537013b4239205fd0aabfa0 to your computer and use it in GitHub Desktop.
Sensible trackball mappings for Kensington Slimblade Trackball in Wayland
# Source: https://askubuntu.com/questions/1145057/remapping-mouse-buttons-to-keyboard-keys
# Scan codes and bus/vendor/product IDs are prefilled for the slimblade.
# Keycodes in HEX - convert to DEC for our config
# https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h#L360
#define BTN_MOUSE 0x110 /* 272 */
#define BTN_LEFT 0x110 /* 272 */
#define BTN_RIGHT 0x111 /* 273 */
#define BTN_MIDDLE 0x112 /* 274 */
#define BTN_SIDE 0x113 /* 275 */ <- back
#define BTN_EXTRA 0x114 /* 276 */ <- forward
#define BTN_FORWARD 0x115 /* 277 */
#define BTN_BACK 0x116 /* 278 */
#define BTN_TASK 0x117 /* 279 */
# Scan codes
# 90003 90004
# BALL
# 90001 90002
# Using the below will give you
# [BACK] [FWD]
# BALL
# [LEFT CLICK] [RIGHT CLICK]
# Format is SCAN_CODE=KEY_CODE_IN_DEC
evdev:input:b0003v047Dp2041*
ID_INPUT_KEY=1
KEYBOARD_KEY_90001=272
KEYBOARD_KEY_90002=273
KEYBOARD_KEY_90003=275
KEYBOARD_KEY_90004=276
# Depending on app support, you might need to switch back to 278 and fwd to 277.
# evdev:input:b0003v047Dp2041*
# ID_INPUT_KEY=1
# KEYBOARD_KEY_90001=272
# KEYBOARD_KEY_90002=273
# KEYBOARD_KEY_90003=278
# KEYBOARD_KEY_90004=277
@Bizzaro
Copy link
Copy Markdown
Author

Bizzaro commented Apr 11, 2026

Drop file in /etc/udev/hwdb.d and run:

sudo systemd-hwdb update && sudo udevadm control --reload-rules && sudo udevadm trigger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment