#2829·yabai

Mouse clicks intermittently dropped while yabai's main thread is blocked in an Accessibility call

Author: WagnerMatosCreated Sep 18, 2026Updated Sep 18, 2026

Environment

  • yabai v7.1.25 (Homebrew), macOS 26 (Tahoe), Apple Silicon
  • yabai is the only active mouse event tap on the machine

Symptom

Mouse clicks intermittently do not register. The cursor keeps moving and the keyboard keeps working; only clicks are affected. It happens while some application is pegging a core — the login launch burst with Messages, Firefox and Teams at 100% CPU is a reliable trigger — and clears once that application settles. With yabai stopped the clicks arrive normally.

Root cause

mouse_handler_begin attaches the CGEventTap's run-loop source to the main run loop (CFRunLoopAddSource(CFRunLoopGetMain(), ...) in src/mouse_handler.c). The main run loop is also where every AXObserver is serviced.

When an AX notification handler makes a synchronous round-trip to an application that is too busy to answer, the main thread blocks until the AX timeout. Captured with sample on yabai's main thread while clicks were being dropped:

application_notification_handler
  _AXUIElementGetWindow
    mach_msg

While the main thread is parked there the tap callback cannot run, WindowServer holds the event until the tap timeout, and the click is dropped (or arrives far too late).

Fix

Run the tap on its own thread with its own CFRunLoop, so the callback never waits on AX. The callback body only reads modifier flags and posts to the event loop, so it has no reason to share a thread with the AX observers. I have been running this fix since 2026-09-17; a listen-only probe tap timed 1000+ clicks with none delayed > 35 ms while the main-thread AX stalls were still occurring. PR to follow.