Repository navigation
Description
OS
macOS 15.3.1 (Build 24D70)
LinearMouse
v0.11.4
Describe the bug
With a high polling-rate mouse (Keychron M6 8K, wired, 8000 Hz — ReportInterval = 125 µs in ioreg), click-and-drag stutters badly while LinearMouse is running: the window/selection lags behind the physical mouse and the animation frame rate drops. Plain pointer movement is smooth; only dragging is affected.
- Quit LinearMouse → dragging is instantly smooth again.
- Relaunch LinearMouse (fresh process, minutes old) → stutter is back, 100% reproducible.
- Set the mouse to 1000 Hz → smooth even with LinearMouse running.
It also reproduces on a machine that is otherwise idle (M4 Max, GPU idle, no thermal pressure), so it is not a load issue.
Root cause
GlobalEventTap observes EventType.all, which unconditionally includes leftMouseDragged, rightMouseDragged and otherMouseDragged (but not mouseMoved, which is exactly why only dragging is affected). The tap is created with .defaultTap at .cghidEventTap, i.e. it is synchronous: WindowServer has to round-trip every observed event through LinearMouse before it can deliver it. At 8000 Hz that is up to 8000 blocking round trips per second while a window is being dragged.
Evidence:
sudo sample WindowServerduring a drag shows SkyLightadd_event_vector_to_tapas the hottest frame.- A small
CGGetEventTapListdump shows LinearMouse's tap is the only enabled synchronous tap on the system whose mask containsleftMouseDragged; the other taps are listen-only or keyboard/scroll only. Its recorded latency spikes into the hundreds of milliseconds. - In my configuration nothing can consume drag events for this device — the scheme only sets
pointer.disableAccelerationandscrolling.modifiers. Drag events are only useful to button mappings,switchPrimaryButtonAndSecondaryButtons,universalBackForward,autoScrollandgesture.
Even at 1000 Hz this is avoidable overhead (see #915); at 4000–8000 Hz it is the difference between usable and not. #1166 had the same symptom but a different cause (fixed in 0.11.1).
To reproduce
-
Use a mouse at 4000/8000 Hz (e.g. Keychron M6 8K wired at 8000 Hz). Check with
ioreg -r -c IOHIDDevice -l | grep -A3 'M6 8K' | grep ReportInterval→125. -
Configure LinearMouse with only pointer/scrolling settings for that device — no button mappings, no auto scroll, no gesture:
{ "if": { "device": { "category": "mouse", "productID": "0xd049", "vendorID": "0x3434" } }, "pointer": { "disableAcceleration": true }, "scrolling": { "modifiers": { "vertical": { "command": { "type": "changeSpeed", "scale": 3 } } } } } -
Drag any window around → stutters.
-
Quit LinearMouse → smooth. Relaunch → stutters. Switch the mouse to 1000 Hz → smooth.
Expected behavior
Dragging should stay smooth when no configured feature needs drag events.
Proposed fix: derive the tap's event mask from the configuration instead of always observing all drag events —
- only include
*MouseDraggedfor buttons that some scheme can actually observe while held: trigger buttons ofbuttons.mappings(includingsimultaneous/whileHeld), left+right whenswitchPrimaryButtonAndSecondaryButtonsis on, back/forward foruniversalBackForward, and theautoScroll/gesturetrigger buttons; - keep the existing rule for
mouseMoved; - recreate the tap when the required set changes (this also means enabling
autoScroll/gesture/redirectsToScrollstarts observingmouseMovedwithout restarting the app).
I'm testing a patch along these lines locally and will follow up with results / a PR once verified.
Anything else?
Hardware: MacBook Pro 16" M4 Max, two 120 Hz displays, Keychron M6 8K (USB 0x3434:0xd049) in wired 8000 Hz mode.
Activity
eret9616 commentedon Sep 4, 2026
Update — tested the fix described above.
Built v0.11.4 with the patch (drag events only observed for buttons a configured feature can use, tap recreated when the required set changes). Result on macOS 15.3.1 with the Keychron M6 8K still at 8000 Hz: window dragging is smooth with LinearMouse running, where the stock v0.11.4 stutters 100% of the time.
CGGetEventTapListconfirms what changed: LinearMouse's tap mask went from0xe401cdeto0xe401c1e—leftMouseDraggedandrightMouseDraggedare no longer observed, whileotherMouseDraggedis still observed because my config maps buttons 2/3 on other devices. Scroll wheel, button down/up and key/flags events are unchanged.Happy to open a PR with the patch if that's welcome.
kenneweg-airoa commentedon Sep 18, 2026
I am also seeing this on LinearMouse 0.11.4, running macOS 26.6.2 (25G83).
At 1000 Hz, dragged windows lag about 2 seconds behind the pointer. Reducing the mouse polling rate to 500 Hz stops the lag for me.
Reduce CPU overhead from pointer motion events (#1412)
lujjjh commentedon Oct 3, 2026
Could you try v0.13.0-beta.1 and let me know if dragging feels smoother?
EdCarney commentedon Nov 9, 2026
Confirming v0.13.0-beta.6 fixes this for me.
On v0.12.0, click-and-drag lagged by several seconds and pointer movement stayed sluggish for a few seconds afterwards; quitting LinearMouse made it go away.
On v0.13.0-beta.6 the dragging is smooth at 1000 Hz with LinearMouse running.