A Linux utility that converts horizontal mouse scroll wheel events to touchpad two-finger swipe gestures, enabling applications like Firefox and Chromium to recognise them as back/forward navigation, and desktop environments to use them for workspace switching.
Note: This project is mainly written by LLM, use with caution.
Applications like Firefox and Chromium interpret two-finger horizontal swipes on touchpads as back/forward navigation. Desktop environments like GNOME and KDE use them for workspace switching. However, none of these recognise horizontal scroll wheel events from mice. The Microsoft All-in-One Media Keyboard has a horizontal scroll wheel that generates these events, so WheelSwipe bridges the gap.
- Exclusively grabs the input device via
EVIOCGRAB, blocking its events from the rest of the system - Creates a virtual mouse (V-Mouse) and forwards all non-horizontal-scroll events to it
- Creates a virtual touchpad (V-Touch) and converts
REL_HWHEEL_HI_RESevents to two-finger horizontal swipes using MT Protocol B;REL_HWHEELevents are ignored to prevent duplicates
- Linux with uinput support
- Root privileges (for device access)
- GCC
makecat /proc/bus/input/devices
# or
sudo evtestsudo ./wheelswipe /dev/input/eventXsudo env IDLE_TIMEOUT_MS=300 SCROLL_TO_PIXEL_RATIO=-2 ./wheelswipe /dev/input/event7| Variable | Default | Constraint | Description |
|---|---|---|---|
IDLE_TIMEOUT_MS |
500 |
> 0 | Milliseconds to wait after last scroll before releasing the simulated touch |
SCROLL_TO_PIXEL_RATIO |
-1 |
!= 0 | Scroll-to-pixel multiplier; negative inverts swipe direction |
SCROLL_RATIO |
1 |
!= 0 | Vertical scroll passthrough multiplier |
Invalid values produce a warning and fall back to the default.
Create /etc/systemd/system/wheelswipe.service:
[Unit]
Description=WheelSwipe - horizontal scroll to gesture converter
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/local/bin/wheelswipe /dev/input/eventX
Restart=on-failure
RestartSec=5
Environment="IDLE_TIMEOUT_MS=500"
Environment="SCROLL_TO_PIXEL_RATIO=-1"
[Install]
WantedBy=multi-user.targetThen:
sudo cp wheelswipe /usr/local/bin/
sudo systemctl daemon-reload
sudo systemctl enable --now wheelswipeNote: The event device path may change on reboot. Consider using udev rules for a stable path.
Permission denied — run with sudo.
Wrong device — use sudo evtest to confirm the device generates REL_HWHEEL_HI_RES events.
Gestures not recognised — ensure gesture support is enabled in your desktop environment or browser. Try adjusting SCROLL_TO_PIXEL_RATIO for sensitivity or increasing IDLE_TIMEOUT_MS if gestures are cut short.
Events not blocked — ensure no other program is grabbing the device.