Multitouch gestures for the Magic Mouse
on Linux.
MouseTouch is a small userspace driver that reads the finger positions the Apple Magic Mouse already reports and replays them as touchpad gestures your desktop understands. Workspace swipes with the native animation, pinch zoom, configurable taps, and a GTK settings app. Nothing patched in the kernel or compositor.
Out of the box
Defaults you get right after installing. Every tap and swipe can be remapped to a shortcut, a mouse button or a command, globally or per application.
Super+W on COSMIC, Super on GNOME.Super+A).Install
Every method below installs both parts: the mousetouch driver (a per-user systemd service)
and the mousetouch-settings app. The settings app is optional and needs GTK 4, libadwaita and PyGObject from your distribution.
One line, any distro
Picks the newest release, verifies the checksum, installs the .deb or .rpm where there is one and the static binary elsewhere. Needs sudo.
curl -fsSL https://raw.githubusercontent.com/Devace-93/mousetouch/main/get.sh | sh
Packages
Download the .deb for your architecture from the releases page (amd64 or arm64). It enables the user service for everyone and starts it for logged-in users. The settings app's GTK dependencies come in as Recommends.
sudo apt install ./mousetouch_<version>_amd64.deb
Download the .rpm from the releases page. Enables and starts the user service like the .deb.
sudo dnf install ./mousetouch-<version>.x86_64.rpm
Settings app dependencies on Fedora: python3-gobject gtk4 libadwaita.
Builds from the main branch. Settings app dependencies are optional: python-gobject gtk4 libadwaita.
yay -S mousetouch-git
systemctl --user enable --now mousetouch
Homebrew on Linux. The formula ships the binaries; follow the printed caveats to install the udev rule once (needs sudo), then start the service.
brew install Devace-93/tap/mousetouch
brew services start mousetouch
Imperative install into your profile:
nix profile install github:Devace-93/mousetouch
Or declaratively on NixOS, which also loads uinput, installs the udev rule and the user service:
# flake.nix inputs
mousetouch.url = "github:Devace-93/mousetouch";
# configuration.nix
imports = [ mousetouch.nixosModules.default ];
services.mousetouch.enable = true;
Binary only. Install the udev rule, modules-load file and user service from packaging/ in the repository by hand afterwards.
cargo install mousetouch
mousetouch-<version>-<arch>-linux.tar.gz from the releases page contains the static binary, the settings app and the udev/systemd/desktop files. Or let the installer do exactly that:
curl -fsSL https://raw.githubusercontent.com/Devace-93/mousetouch/main/get.sh | MOUSETOUCH_FORCE_TARBALL=1 sh
Needs a Rust toolchain. install.sh builds the release binary, installs it to /usr/local with the udev rule, modules-load file, desktop entry and settings app, and enables the per-user service.
git clone https://github.com/Devace-93/mousetouch
cd mousetouch
./install.sh
Remove it again with ./uninstall.sh (--purge also deletes the config).
Requirements
- A Magic Mouse connected over Bluetooth (the cable only charges on Linux), bound to the in-tree
hid-magicmousemodule. The DKMS build works too. /dev/uinput(standard) and systemd for the per-user service.- A Wayland compositor with libinput touchpad gestures: COSMIC, GNOME, KDE, niri, Sway, Hyprland, …
- For the settings app: Python 3, PyGObject, GTK 4, libadwaita (
python3-gi gir1.2-gtk-4.0 gir1.2-adw-1on Debian/Ubuntu/Pop!_OS).
After installing
- If the mouse was already paired, re-pair it or run
sudo udevadm triggerso the udev rule applies. - Check the daemon:
systemctl --user status mousetouch. - Swipe left/right with two fingers. Done.
systemctl --user enable --now mousetouch step.Settings app
A GTK4 / libadwaita app, installed alongside the driver by every method above. Launch MouseTouch from the app menu or run it from a terminal:
mousetouch-settings
It edits ~/.config/mousetouch/config.toml, which the daemon reloads on save. No restart needed.
What you can change
- Workspace swipe: direction, sensitivity, 3 or 4 synthetic fingers, horizontal or both axes (GNOME).
- Pinch zoom on/off and aggressiveness.
- One-finger scroll: notches vs smooth, speed, start-direction filter.
- Tap timing and lift-speed detection.
- Rules: tap / double tap / swipe × fingers → key combo, mouse button, command, toggle or cycle, optionally only for one application.
How it works
The Magic Mouse reports every finger on its surface, but desktops ignore that because the device is a mouse. MouseTouch bridges the gap in userspace.
/dev/hidrawN), with an evdev multitouch fallback.Troubleshooting
mousetouch probe # is the mouse seen, with touch axes?
mousetouch watch # live finger positions
mousetouch demo-swipe left 40 # replay a synthetic 4-finger swipe
journalctl --user -fu mousetouch
| Symptom | Check |
|---|---|
| No device found | Mouse must be on Bluetooth and bound to hid-magicmouse. |
| Swipe goes the wrong way | Flip Direction in the settings app, or set touchpad natural scrolling explicitly. |
| Nothing happens on swipe | The desktop must handle 4-finger (or 3-finger) touchpad swipes and not disable touchpads while a mouse is connected. |
| Permission denied | Make sure the udev rule is installed, or add yourself to the input group. |
app rules never fire | Run with -v and look for "focus tracking via". GNOME exposes no toplevel protocol, so app rules never match there. |