Repository navigation
fix(brightness): resume keyboard ALS after an off leftover - #486
oliverlukschander wants to merge 2 commits into
Conversation
Lock-screen blanking and systemd-backlight restore write 0 (or a 1% leftover) to kbd_backlight. The auto daemon treated that as a Shift+F1/F2 override and stayed paused while room light was stable, so the keys could remain invisible. Treat an effectively-off LED as not a manual choice; visible manual levels still pause.
wesleygrimes
left a comment
There was a problem hiding this comment.
Thanks for tracking this down @oliverlukschander. What about people who deliberately turn the keyboard backlight off? Could we preserve that manual choice while still recovering from lock-screen blanking or a saved near-zero restore? It would be good to test both cases.
Treating every near-zero LED level as a leftover also relit keys the user had turned off on purpose. omarchy-brightness-keyboard now records the level a key press changes the LED to, and the ALS daemon counts an off level as a choice once the last key press turned the keys off. That off holds until the next key press; lock blanks and near-zero restores still resume ALS. The daemon drops the record when it writes the LED itself or starts, and reads it as digits only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Good call: the first version couldn't tell the two apart. Both just looked like "LED ≤ 2%" to the daemon. ad228ce keys it on who wrote the level instead of what level is left:
Both cases are tested through the real key, lock-blank and restore paths in One related thing I found along the way: |
|
Closing this in favour of #533: @maralcbr already landed the same fix on Two small things I found along the way, in case they're useful. Happy to send either as a PR if wanted:
|
What's wrong
omarchy-brightness-keyboard-autopauses whenever anything else writes the keyboard LED, and only resumes after ambient light moves a lot (20 lux, or 40%). That is the right behavior forShift+F1/F2to a visible level. It is the wrong behavior for lock-screen blanking (brightnessctl -s set 0), a restore of a saved 0% level, or a 1% leftover (2/255), which is invisible: the daemon stays paused on dark keys.On an M2 Pro (apple,j416s) the ALS daemon was running, room light was ~26 lux (maps to ~90%), and
kbd_backlightsat at 2/255. A fresh--onceimmediately applied ~88%. PWM hardware was fine; the daemon had paused on an off leftover and never resumed in a stable room.The change
The daemon tells a deliberate off from a leftover by who wrote it, not by the level left behind:
omarchy-brightness-keyboard up|down|cycle(the key bindings) records the level each key press changes the LED to, in$XDG_RUNTIME_DIR.off/restore(lock-screen blank, wake) record nothing.Testing
bash test/shell.d/brightness-keyboard-auto-test.shdrives the daemon's tick one poll at a time, with every LED write going through the realomarchy-brightness-keyboardkey, lock-blank and restore paths:bin/omarchy commands --checkpassed; the syntax check overbin/omarchy-*is clean./test/allhas 6 failures, identical on a cleanquattrocheckout and unrelated to this helper (arm-channel-staging,config,package-build-contract,runtime-smoke,settings-package-units,unowned-system-paths; noomarchy-pkgscheckout here)leds_pwm): the LED reads back exactly the recorded level; stepping down from 226 stops at 1 and holds through a blank, the restore and a darkened room; the next key press ends the hold; a blank of lit keys is relitNot addressed here
omarchy-system-wakerestores the last blank's saved level on every unlock, even when nothing was blanked since, which can still relight keys turned off by hand. That is a lock/wake change with its own trade-offs, so it goes in a separate follow-up PR.omarchy update. No migration: the helper is the packaged binary the user unit already runs.🤖 Generated with Claude Code