Post History
Wayland, ideally If you are on Wayland, the blessed way is to use the configuration for your desktop environment (DE) to map mouse keys and other input devices, except for a couple well-known opti...
Answer
#3: Post edited
- # Wayland, ideally
- If you are on Wayland, the blessed way is to [use the configuration for your desktop environment][libinput-de] (DE) to map mouse keys and other input devices, except for a couple well-known options (eg [left-handed mode][lefty] and [middle mouse emulation][middle-mouse]).
- # Wayland, via [`hwdb`][hwdb]
- If your DE _doesn't have_ configuration for mouse key bindings, you may be able to mess with the `hwdb` like [this person on Reddit][reddit]. Wayland's current version of `libinput` says [not to do this anymore][wayland-hwdb-deprecated], but if you're stuck you're stuck.
- ### Get the device ID
- > ```sh
- > $ lsusb | grep Kens
- > Bus 001 Device 008: ID 047d:8018 Kensington
- > ```
- ### Get the input events with `evtest`
- > ```
- > Event: time 1584228876.372060, -------------- SYN_REPORT ------------
- > Event: time 1584228877.572302, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
- > Event: time 1584228877.572302, type 1 (EV_KEY), code 275 (BTN_SIDE), value 1
- > Event: time 1584228877.572302, -------------- SYN_REPORT ------------
- > ```
- > I was lucky because I really just wanted to swap two buttons, and `evtest` dumped the supported events when you select your device. You may be able to figure out the key codes to emulate. I did get hung up on `evtest` reporting `BTN_SIDE`, but having to use lower-case `btn_side` in the `hwdb` entry.
- ### Add changes to the `hwdb`
> I'm on Fedora 31, and have been using [hwdb][wayland-hwdb-1.11.3] entry for a while, because I didn't like the default button configuration on my trackball -- they're frankly backwards for a right-handed person, and the Windows software recognized the need to swap them. (note: Indents are important iirc)- >
- > [The] rule in my `hwdb` entry (`evdev:input:b*v047Dp8018*`) is just the USB Vendor + Product
- >
- > ```sh
- > $ cat 90-trackball-buttons.hwdb
- > # Kensington Expert Mouse Trackball:
- > # * Rebind top-left from BTN_MIDDLE to BTN_SIDE
- > # * Rebind top-right from BTN_SIDE to BTN_MIDDLE
- > evdev:input:b*v047Dp8018*
- > KEYBOARD_KEY_90003=btn_side
- > KEYBOARD_KEY_90004=btn_middle
- >```
- ### [Reload your `hwdb`][wayland-hwdb-reload]
- ```sh
- $ sudo systemd-hwdb update
- $ sudo udevadm trigger /sys/class/input/eventX
- ```
- [libinput-de]: https://wayland.freedesktop.org/libinput/doc/latest/faqs.html#how-do-i-configure-my-device-on-wayland
- [lefty]: https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#left-handed-mode
- [middle-mouse]: https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#middle-button-emulation
- [hwdb]: https://www.mankier.com/7/hwdb
- [reddit]: https://www.reddit.com/r/linux4noobs/comments/fih5aw/comment/fkiuyui/
- [wayland-hwdb-deprecated]: https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html#modifying-the-hwdb
- [wayland-hwdb-1.11.3]: https://wayland.freedesktop.org/libinput/doc/1.11.3/udev_config.html#hwdb
- [wayland-hwdb-reload]: https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html#reloading-the-hwdb
- # Wayland, ideally
- If you are on Wayland, the blessed way is to [use the configuration for your desktop environment][libinput-de] (DE) to map mouse keys and other input devices, except for a couple well-known options (eg [left-handed mode][lefty] and [middle mouse emulation][middle-mouse]).
- # Wayland, via [`hwdb`][hwdb]
- If your DE _doesn't have_ configuration for mouse key bindings, you may be able to mess with the `hwdb` like [this person on Reddit][reddit]. Wayland's current version of `libinput` says [not to do this anymore][wayland-hwdb-deprecated], but if you're stuck you're stuck.
- ### Get the device ID
- > ```sh
- > $ lsusb | grep Kens
- > Bus 001 Device 008: ID 047d:8018 Kensington
- > ```
- ### Get the input events with `evtest`
- > ```
- > Event: time 1584228876.372060, -------------- SYN_REPORT ------------
- > Event: time 1584228877.572302, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
- > Event: time 1584228877.572302, type 1 (EV_KEY), code 275 (BTN_SIDE), value 1
- > Event: time 1584228877.572302, -------------- SYN_REPORT ------------
- > ```
- > I was lucky because I really just wanted to swap two buttons, and `evtest` dumped the supported events when you select your device. You may be able to figure out the key codes to emulate. I did get hung up on `evtest` reporting `BTN_SIDE`, but having to use lower-case `btn_side` in the `hwdb` entry.
- ### Add changes to the `hwdb`
- > I'm on Fedora 31, and have been using [a] [`hwdb`][wayland-hwdb-1.11.3] entry for a while, because I didn't like the default button configuration on my trackball -- they're frankly backwards for a right-handed person, and the Windows software recognized the need to swap them. (note: Indents are important iirc)
- >
- > [The] rule in my `hwdb` entry (`evdev:input:b*v047Dp8018*`) is just the USB Vendor + Product
- >
- > ```sh
- > $ cat 90-trackball-buttons.hwdb
- > # Kensington Expert Mouse Trackball:
- > # * Rebind top-left from BTN_MIDDLE to BTN_SIDE
- > # * Rebind top-right from BTN_SIDE to BTN_MIDDLE
- > evdev:input:b*v047Dp8018*
- > KEYBOARD_KEY_90003=btn_side
- > KEYBOARD_KEY_90004=btn_middle
- >```
- ### [Reload your `hwdb`][wayland-hwdb-reload]
- ```sh
- $ sudo systemd-hwdb update
- $ sudo udevadm trigger /sys/class/input/eventX
- ```
- [libinput-de]: https://wayland.freedesktop.org/libinput/doc/latest/faqs.html#how-do-i-configure-my-device-on-wayland
- [lefty]: https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#left-handed-mode
- [middle-mouse]: https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#middle-button-emulation
- [hwdb]: https://www.mankier.com/7/hwdb
- [reddit]: https://www.reddit.com/r/linux4noobs/comments/fih5aw/comment/fkiuyui/
- [wayland-hwdb-deprecated]: https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html#modifying-the-hwdb
- [wayland-hwdb-1.11.3]: https://wayland.freedesktop.org/libinput/doc/1.11.3/udev_config.html#hwdb
- [wayland-hwdb-reload]: https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html#reloading-the-hwdb
#2: Post edited
- If you are on Wayland, the blessed way is to [use the configuration for your desktop environment][libinput-de] (DE) to map mouse keys and other input devices, except for a couple well-known options (eg [left-handed mode][lefty] and [middle mouse emulation][middle-mouse]).
If your DE _doesn't have_ configuration for mouse key bindings, you may be able to mess with the `hwdb` like [this person on Reddit][reddit]. Wayland's version of `libinput` says [not to do this anymore][no-hwdb], but if you're stuck you're stuck.- ### Get the device ID
- > ```sh
- > $ lsusb | grep Kens
- > Bus 001 Device 008: ID 047d:8018 Kensington
- > ```
- ### Get the input events with `evtest`
- > ```
- > Event: time 1584228876.372060, -------------- SYN_REPORT ------------
- > Event: time 1584228877.572302, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
- > Event: time 1584228877.572302, type 1 (EV_KEY), code 275 (BTN_SIDE), value 1
- > Event: time 1584228877.572302, -------------- SYN_REPORT ------------
- > ```
- > I was lucky because I really just wanted to swap two buttons, and `evtest` dumped the supported events when you select your device. You may be able to figure out the key codes to emulate. I did get hung up on `evtest` reporting `BTN_SIDE`, but having to use lower-case `btn_side` in the `hwdb` entry.
- ### Add changes to the `hwdb`
> I'm on Fedora 31, and have been using [hwdb] entry for a while, because I didn't like the default button configuration on my trackball -- they're frankly backwards for a right-handed person, and the Windows software recognized the need to swap them. (note: Indents are important iirc)- >
- > [The] rule in my `hwdb` entry (`evdev:input:b*v047Dp8018*`) is just the USB Vendor + Product
- >
- > ```sh
- > $ cat 90-trackball-buttons.hwdb
- > # Kensington Expert Mouse Trackball:
- > # * Rebind top-left from BTN_MIDDLE to BTN_SIDE
- > # * Rebind top-right from BTN_SIDE to BTN_MIDDLE
- > evdev:input:b*v047Dp8018*
- > KEYBOARD_KEY_90003=btn_side
- > KEYBOARD_KEY_90004=btn_middle
- >```
### [Reload your `hwdb`][hwdb-reload]- ```sh
- $ sudo systemd-hwdb update
- $ sudo udevadm trigger /sys/class/input/eventX
- ```
- [libinput-de]: https://wayland.freedesktop.org/libinput/doc/latest/faqs.html#how-do-i-configure-my-device-on-wayland
- [lefty]: https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#left-handed-mode
- [middle-mouse]: https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#middle-button-emulation
- [reddit]: https://www.reddit.com/r/linux4noobs/comments/fih5aw/comment/fkiuyui/
[no-hwdb]: https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html#modifying-the-hwdb[hwdb]: https://wayland.freedesktop.org/libinput/doc/1.11.3/udev_config.html#hwdb[hwdb-reload]: https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html#reloading-the-hwdb
- # Wayland, ideally
- If you are on Wayland, the blessed way is to [use the configuration for your desktop environment][libinput-de] (DE) to map mouse keys and other input devices, except for a couple well-known options (eg [left-handed mode][lefty] and [middle mouse emulation][middle-mouse]).
- # Wayland, via [`hwdb`][hwdb]
- If your DE _doesn't have_ configuration for mouse key bindings, you may be able to mess with the `hwdb` like [this person on Reddit][reddit]. Wayland's current version of `libinput` says [not to do this anymore][wayland-hwdb-deprecated], but if you're stuck you're stuck.
- ### Get the device ID
- > ```sh
- > $ lsusb | grep Kens
- > Bus 001 Device 008: ID 047d:8018 Kensington
- > ```
- ### Get the input events with `evtest`
- > ```
- > Event: time 1584228876.372060, -------------- SYN_REPORT ------------
- > Event: time 1584228877.572302, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
- > Event: time 1584228877.572302, type 1 (EV_KEY), code 275 (BTN_SIDE), value 1
- > Event: time 1584228877.572302, -------------- SYN_REPORT ------------
- > ```
- > I was lucky because I really just wanted to swap two buttons, and `evtest` dumped the supported events when you select your device. You may be able to figure out the key codes to emulate. I did get hung up on `evtest` reporting `BTN_SIDE`, but having to use lower-case `btn_side` in the `hwdb` entry.
- ### Add changes to the `hwdb`
- > I'm on Fedora 31, and have been using [hwdb][wayland-hwdb-1.11.3] entry for a while, because I didn't like the default button configuration on my trackball -- they're frankly backwards for a right-handed person, and the Windows software recognized the need to swap them. (note: Indents are important iirc)
- >
- > [The] rule in my `hwdb` entry (`evdev:input:b*v047Dp8018*`) is just the USB Vendor + Product
- >
- > ```sh
- > $ cat 90-trackball-buttons.hwdb
- > # Kensington Expert Mouse Trackball:
- > # * Rebind top-left from BTN_MIDDLE to BTN_SIDE
- > # * Rebind top-right from BTN_SIDE to BTN_MIDDLE
- > evdev:input:b*v047Dp8018*
- > KEYBOARD_KEY_90003=btn_side
- > KEYBOARD_KEY_90004=btn_middle
- >```
- ### [Reload your `hwdb`][wayland-hwdb-reload]
- ```sh
- $ sudo systemd-hwdb update
- $ sudo udevadm trigger /sys/class/input/eventX
- ```
- [libinput-de]: https://wayland.freedesktop.org/libinput/doc/latest/faqs.html#how-do-i-configure-my-device-on-wayland
- [lefty]: https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#left-handed-mode
- [middle-mouse]: https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#middle-button-emulation
- [hwdb]: https://www.mankier.com/7/hwdb
- [reddit]: https://www.reddit.com/r/linux4noobs/comments/fih5aw/comment/fkiuyui/
- [wayland-hwdb-deprecated]: https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html#modifying-the-hwdb
- [wayland-hwdb-1.11.3]: https://wayland.freedesktop.org/libinput/doc/1.11.3/udev_config.html#hwdb
- [wayland-hwdb-reload]: https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html#reloading-the-hwdb
#1: Initial revision
If you are on Wayland, the blessed way is to [use the configuration for your desktop environment][libinput-de] (DE) to map mouse keys and other input devices, except for a couple well-known options (eg [left-handed mode][lefty] and [middle mouse emulation][middle-mouse]). If your DE _doesn't have_ configuration for mouse key bindings, you may be able to mess with the `hwdb` like [this person on Reddit][reddit]. Wayland's version of `libinput` says [not to do this anymore][no-hwdb], but if you're stuck you're stuck. ### Get the device ID > ```sh > $ lsusb | grep Kens > Bus 001 Device 008: ID 047d:8018 Kensington > ``` ### Get the input events with `evtest` > ``` > Event: time 1584228876.372060, -------------- SYN_REPORT ------------ > Event: time 1584228877.572302, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003 > Event: time 1584228877.572302, type 1 (EV_KEY), code 275 (BTN_SIDE), value 1 > Event: time 1584228877.572302, -------------- SYN_REPORT ------------ > ``` > I was lucky because I really just wanted to swap two buttons, and `evtest` dumped the supported events when you select your device. You may be able to figure out the key codes to emulate. I did get hung up on `evtest` reporting `BTN_SIDE`, but having to use lower-case `btn_side` in the `hwdb` entry. ### Add changes to the `hwdb` > I'm on Fedora 31, and have been using [hwdb] entry for a while, because I didn't like the default button configuration on my trackball -- they're frankly backwards for a right-handed person, and the Windows software recognized the need to swap them. (note: Indents are important iirc) > > [The] rule in my `hwdb` entry (`evdev:input:b*v047Dp8018*`) is just the USB Vendor + Product > > ```sh > $ cat 90-trackball-buttons.hwdb > # Kensington Expert Mouse Trackball: > # * Rebind top-left from BTN_MIDDLE to BTN_SIDE > # * Rebind top-right from BTN_SIDE to BTN_MIDDLE > evdev:input:b*v047Dp8018* > KEYBOARD_KEY_90003=btn_side > KEYBOARD_KEY_90004=btn_middle >``` ### [Reload your `hwdb`][hwdb-reload] ```sh $ sudo systemd-hwdb update $ sudo udevadm trigger /sys/class/input/eventX ``` [libinput-de]: https://wayland.freedesktop.org/libinput/doc/latest/faqs.html#how-do-i-configure-my-device-on-wayland [lefty]: https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#left-handed-mode [middle-mouse]: https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#middle-button-emulation [reddit]: https://www.reddit.com/r/linux4noobs/comments/fih5aw/comment/fkiuyui/ [no-hwdb]: https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html#modifying-the-hwdb [hwdb]: https://wayland.freedesktop.org/libinput/doc/1.11.3/udev_config.html#hwdb [hwdb-reload]: https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html#reloading-the-hwdb