Fix brightness slider h/l bouncing to zero

This commit is contained in:
Ryan Hughes
2026-05-18 00:55:46 -04:00
parent 0d6c58a2df
commit 8ec794a1b4
@@ -327,12 +327,17 @@ Item {
Process {
id: setBrightnessProc
stdout: StdioCollector { waitForEnd: true }
// Do NOT call refresh() after a brightness set completes. The local
// brightnessPercent we just wrote is authoritative; re-reading via
// `omarchy-brightness-display` races the hardware/driver and can
// return an empty string, which the parser then coerces to 0 —
// visible as a "bounce to zero" after h/l keypresses. External
// brightness changes are still picked up by the 5s periodic refresh,
// the open-time refresh, and Component.onCompleted.
onRunningChanged: {
if (running) return
if (root.brightnessSetQueued) {
root.setBrightness(root.pendingBrightnessPercent)
} else {
root.refresh()
}
}
}