https://github.com/asidko/gnome-touchpad-emulator-toggle
GNOME Shell extension that adds a Quick Settings tile to toggle TouchpadEmulator on Linux phones.
https://github.com/asidko/gnome-touchpad-emulator-toggle
gnome-shell gnome-shell-extension linux-phone mobian pinephone postmarketos quick-settings touchpad-emulator wayland
Last synced: 11 days ago
JSON representation
GNOME Shell extension that adds a Quick Settings tile to toggle TouchpadEmulator on Linux phones.
- Host: GitHub
- URL: https://github.com/asidko/gnome-touchpad-emulator-toggle
- Owner: asidko
- License: mit
- Created: 2026-05-17T11:26:44.000Z (18 days ago)
- Default Branch: main
- Last Pushed: 2026-05-17T11:29:20.000Z (18 days ago)
- Last Synced: 2026-05-23T23:37:25.767Z (11 days ago)
- Topics: gnome-shell, gnome-shell-extension, linux-phone, mobian, pinephone, postmarketos, quick-settings, touchpad-emulator, wayland
- Language: JavaScript
- Size: 584 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GNOME Touchpad Emulator Toggle
A minimal GNOME Shell extension that adds a **Touchpad Mode** tile to the Quick Settings panel. One tap to start [TouchpadEmulator](https://gitlab.com/CalcProgrammer1/TouchpadEmulator), one tap to stop. Useful on Linux phones (postmarketOS, Mobian) where you want trackpad-style cursor input from a quick-settings toggle instead of hunting for the app icon.

## Why
TouchpadEmulator ships with a `.desktop` launcher, but on a phone it's faster to flip it from the same pulldown as Wi-Fi and brightness. Tapping the tile spawns the binary directly and tracks its lifecycle — no polling, no `pkill` scanning, no shell launcher.
## Requirements
- GNOME Shell 45 – 50 (tested on 50.1).
- [`touchpad-emulator`](https://gitlab.com/CalcProgrammer1/TouchpadEmulator) installed and `/usr/bin/TouchpadEmulator` on `$PATH`.
- `/dev/uinput` and `/dev/input/event*` accessible to your user (the upstream `touchpad-emulator` package ships a udev rule for this).
On postmarketOS:
```sh
sudo apk add touchpad-emulator
```
## Install
```sh
git clone https://github.com/asidko/gnome-touchpad-emulator-toggle.git \
~/.local/share/gnome-shell/extensions/touchpad-emulator@local
```
Log out and log back in (Wayland — extensions can't be loaded into a running session), then enable:
```sh
gnome-extensions enable touchpad-emulator@local
```
The tile appears in Quick Settings as **Touchpad Mode**.
## How it works
- Spawns `/usr/bin/TouchpadEmulator` directly via `Gio.Subprocess`. `wait_async` on the child is the single source of truth for tile state — if the process exits for any reason, the tile auto-greys.
- Stop sends `SIGTERM` to the held subprocess handle, so there's no `pkill` scanning and no chance of killing the wrong process.
- A one-shot `pgrep` at startup adopts any TouchpadEmulator started outside the tile (e.g. autostart); for that case only, stop falls back to `pkill -f`.
## Notes for postmarketOS / Snapdragon devices
- TouchpadEmulator claims `iio-sensor-proxy` for its own screen-rotation feature. GNOME's auto-rotate quick-setting will disappear while the emulator is running and reappear on stop. This is expected — only one process can claim the accelerometer at a time.
- Alpine's `killall`/`pkill -x` silently fail to match process names longer than 15 characters (kernel `comm` truncation). The shipped `LaunchTouchpadEmulator.sh` hits this bug; this extension avoids it by spawning the binary directly and matching with `pkill -f`.
## Uninstall
```sh
gnome-extensions disable touchpad-emulator@local
rm -rf ~/.local/share/gnome-shell/extensions/touchpad-emulator@local
```
## License
MIT