Fix brightness HUD not working on macOS Tahoe 26.5

The brightness HUD broke on Tahoe because Apple deprecated/changed the
DisplayServices private framework and stopped posting the BezelEngine
distributed notifications that Atoll relied on for change detection.

This commit:
- Adds CoreBrightnessDisplayClient using Apple's CoreBrightness framework
  (mirrors the existing KeyboardBrightnessClient pattern) as the primary
  brightness read/write path
- Falls back gracefully to DisplayServices then IODisplay if CoreBrightness
  is unavailable
- Adds a lightweight polling fallback (150ms) so the HUD fires even when
  no distributed notifications are posted (Control Center, Touch Bar, auto-
  brightness changes)
- Registers the new com.apple.CoreBrightness.DisplayBrightnessChanged
  notification
- Fixes deprecated kIOMasterPortDefault → kIOMainPortDefault in
  SystemDisplayManager.swift

Fixes #452

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Joseph 2026-05-18 12:08:01 +01:00
commit fc063499ae
3 changed files with 110 additions and 2 deletions

View file

@ -46,7 +46,7 @@ class SystemDisplayManager {
private static func getStandardDisplayBrightness() throws -> Float {
var brightness: float_t = 1
let service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IODisplayConnect"))
let service = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceMatching("IODisplayConnect"))
defer {
IOObjectRelease(service)
}