Skip to content

Fix Mission Control, brightness controls, and cursor dimming#9

Open
gitkamaal wants to merge 3 commits intolevelsio:mainfrom
gitkamaal:fix/mission-control-brightness-polish
Open

Fix Mission Control, brightness controls, and cursor dimming#9
gitkamaal wants to merge 3 commits intolevelsio:mainfrom
gitkamaal:fix/mission-control-brightness-polish

Conversation

@gitkamaal
Copy link
Copy Markdown

Summary

  • Fixes XDR boost doesn't work when Mission Control is active #8 — XDR boost overlay now persists through Mission Control by observing activeSpaceDidChangeNotification and reasserting the window after space switches
  • Fixes cursor dimming — Lowered window level from .screenSaver (1000) to a custom level (200), which avoids macOS special-casing that interferes with cursor compositing during Mission Control
  • Fixes brightness keyboard controls — Watchdog now tracks EDR headroom changes every 1.5s (down from 3s) and dynamically clamps the boost level when the user adjusts brightness via keyboard, preventing the boost from exceeding available headroom
  • Bug fix — Kill switch (--kill) no longer terminates itself; uses pgrep + targeted kill instead of pkill -f

Changes

Area What changed
Window level .screenSaver → custom 200 (above all apps, avoids system special-casing)
Mission Control Added activeSpaceDidChangeNotification observer + reassertOverlay()
Brightness tracking Watchdog polls maximumPotentialExtendedDynamicRangeColorComponentValue and clamps boost
EDR loss handling Graceful deactivation when headroom drops to 1.0 (very low brightness)
Window behavior Added .ignoresCycle (hides from Cmd+Tab) and .animationBehavior = .none
Screen wake Added screensDidWakeNotification observer with delay for correct EDR reporting
Kill switch pgrep + per-PID kill instead of pkill -f (avoids self-termination)
Code cleanup Extracted reassertOverlay() and updateBoostMenuState() helpers

Test plan

  • Toggle XDR boost on, enter Mission Control (three-finger swipe up), verify overlay stays active
  • Switch between Spaces with boost active — overlay should persist
  • Adjust brightness with keyboard while boost is active — boost should clamp to available headroom
  • Lower brightness to minimum — boost should auto-deactivate; raise brightness — re-enable manually
  • Verify mouse cursor is not visibly dimmed compared to surrounding content
  • Run xdr-boost --kill while another instance is running — verify it kills the other instance, not itself
  • Sleep/wake cycle with boost active — verify it recovers

🤖 Generated with Claude Code

gitkamaal and others added 3 commits April 2, 2026 23:51
- Lower window level from .screenSaver (1000) to custom 200 to avoid macOS
  special-casing during Mission Control that hides the overlay, and to prevent
  cursor compositing interference that dims the mouse pointer
- Add activeSpaceDidChangeNotification observer to reassert overlay after
  Mission Control or space switches (fixes levelsio#8)
- Track EDR headroom changes in watchdog (1.5s interval, down from 3s) so
  keyboard brightness adjustments dynamically clamp the boost level instead
  of exceeding available headroom
- Deactivate gracefully when EDR headroom drops to 1.0 (very low brightness)
- Add .ignoresCycle and .animationBehavior = .none to prevent the overlay
  from appearing in Mission Control window list and animation glitches
- Fix kill switch: use pgrep + targeted kill instead of pkill to avoid
  the --kill process terminating itself
- Add screen wake observer with delay for correct EDR reporting
- Extract reassertOverlay() and updateBoostMenuState() to reduce duplication

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
KeepAlive was set to unconditional true, so launchd restarted xdr-boost
every time it exited — including user-initiated Quit and --kill. Changed
to SuccessfulExit: false so launchd only restarts on crashes (non-zero
exit code), not on clean exits (exit 0).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ntegration

Root causes of flicker:
- handleDisplayChange did a full deactivate/reactivate cycle, causing a
  visible flash every time brightness keys were pressed
- Watchdog at 1.5s was comparing frames with display:true, forcing redraws
- Exact float comparison on maxEDR fired on tiny jitter
- Multiple event handlers could overlap with no debouncing

Fixes:
- handleDisplayChange now updates overlay IN-PLACE (resize frame, update
  clear color) instead of destroy/recreate — no more flash
- Restore .screenSaver window level (200 was too low and got caught in
  Mission Control window management)
- Separate boostLevel (user's choice) from effectiveBoost (clamped to
  maxEDR) so the user's preference is preserved when headroom fluctuates
- Use epsilon (0.05) for float comparisons to avoid jitter-triggered updates
- Add debouncing via DispatchWorkItem for reassert calls
- Watchdog back to 3s as a safety net — event observers handle time-sensitive
  recovery (space change, screen wake)
- Watchdog no longer touches window frame — only checks visibility
- Menu bar shows "☀︎ 2.0x" when active, plain "☀" when off
- Menu shows EDR headroom info
- Better toggle labels ("Turn On/Off XDR Boost")

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

XDR boost doesn't work when Mission Control is active

1 participant