Skip to content

Add Linux support via evdev#1

Draft
thfaix with Copilot wants to merge 2 commits into
masterfrom
copilot/adapt-code-for-linux-support
Draft

Add Linux support via evdev#1
thfaix with Copilot wants to merge 2 commits into
masterfrom
copilot/adapt-code-for-linux-support

Conversation

Copilot AI commented Mar 16, 2026

Copy link
Copy Markdown

Mouser only worked on Windows and macOS. This adds Linux support across all platform-specific modules.

Changes

core/config.py

  • Linux config stored at ~/.config/Mouser, respecting $XDG_CONFIG_HOME

core/app_detector.py

  • Detects active window via xdotool getactivewindow getwindowpid/proc/<pid>/comm
  • Falls back to wmctrl -lp + xprop -root _NET_ACTIVE_WINDOW
  • PID values are validated as digits-only before use in /proc paths

core/key_simulator.py

  • Lazy-initialized evdev.UInput virtual keyboard for kernel-level key injection (works on X11 and Wayland)
  • 22 actions mapped to Linux conventions: Ctrl instead of Cmd, KEY_LEFTMETA for Super/Win, native media/browser keys

core/mouse_hook.py

  • Discovers all pointer devices in /dev/input (requires BTN_LEFT + REL_X/Y)
  • Grabs each device exclusively; creates a matching UInput passthrough so the pointer keeps working
  • Handles BTN_MIDDLE, BTN_SIDE/BTN_BACK, BTN_EXTRA/BTN_FORWARD, hi-res REL_HWHEEL
  • Gesture direction tracking (same algorithm as macOS) via accumulated REL_X/Y per sync frame
  • Scroll inversion applied at UInput write time
  • Integrates with HidGestureListener for the MX Master 3S gesture button (HID++ protocol)

requirements.txt

evdev>=1.6.0; sys_platform == "linux"

Required Linux setup

sudo usermod -aG input $USER    # read /dev/input
sudo usermod -aG uinput $USER   # write /dev/uinput
sudo apt install xdotool         # or: wmctrl x11-utils (app auto-switching)

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: thfaix <17575835+thfaix@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Linux support for existing application Add Linux support via evdev Mar 16, 2026
Copilot AI requested a review from thfaix March 16, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants