Repository navigation
Keep the keyboard backlight level when the lock blanks again before a wake - #15908
Conversation
The lock blanks with `omarchy-brightness-keyboard off`, which saved the current level with `brightnessctl -s` before setting 0, and wakes with `restore`. Since the lock re-arms its blank timer after a resume (and when a screen arrives) without waking in between, a second blank saved the 0 the first one had set, and unlock restored 0. `off` now records the level only when nothing is already saved, and `restore` consumes it, so the level from before the first blank survives any number of blanks. Blank and wake run as separate processes, so both take a lock; a level that cannot be read is left lit, and a restore the device rejects keeps the level for the next wake. Co-Authored-By: Codex Medium <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
[Medium impact] The PR appears safe to merge. SummaryThe PR keeps the keyboard brightness saved before the first blank until a wake restores it.
The previous test-cleanup finding is fully addressed. No new actionable issues were found. Reviews (3) · Last reviewed commit: "Silence and reap the overlap test's back..." · Reviewed by Greptile |
A save that creates the record and then fails to write it, as a full runtime directory does, left an empty file. off checked only that the file existed, so it blanked anyway, and restore discarded the empty record without restoring: the keyboard stayed dark. off now removes a record it could not write and blanks only over a non-empty one, and an empty record left behind is replaced by the next off. The tests now hold a blank paused mid-save while a wake starts, which fails when the flock is removed, and check that a rejected restore leaves the backlight where it was. Co-Authored-By: Codex Medium <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Without the first check, a save guard that left an empty record in place passed: off skipped the blank and restore found the light still on. Without the second, a blank that never reached its save let the overlap test run restore first. Co-Authored-By: Codex Medium <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/testing.md asks background fixtures to send their output elsewhere and be cleaned up on exit. The exit trap releases the paused blank and waits, since killing the backgrounded subshell would leave the script under it running against the deleted directory. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Reviewed and verified on a worker: it fixes the backlight half of #12994. I pushed one fix and tightened the tests. The bug is real. On a worker built from the Omarchy ISO, I made a real keyboard backlight LED with the kernel's Pushed:
Tests: Second opinion: Codex Medium reviewed four rounds, and its independence from this review is not guaranteed. In the first round it found the empty-record case on its own, which matches the Greptile comment. It also agreed that the overlap had no test. In the second round it found two ways the new tests could pass when the code was wrong, and both are fixed in f94e9ab. Its last two rounds, the final one on this head, found nothing. One finding was left unchanged: if every wake fails to restore the level, the record is kept, so a level the user sets afterwards with the brightness keys can be overridden at the next lock. That only happens on a device that rejects the restore but accepts a later set. Keeping the record for a retry is deliberate, and Codex withdrew the finding. This does not close #12994, because the keyboard-layout half is untouched, and the hibernate hook is #13729 and #14066. It is waiting on the maintainer. |
…ware levels omacom#15908 landed the repeated-blank and unpaired-restore fixes on quattro with a level record and a lock, so this branch now builds on that instead of its own marker. What it still adds: a level changed with the keys while blanked replaces the record, unless the key changed nothing (down at 0), and restore leaves a backlight that something else lit since the blank, as a firmware key does, at its level. The grep-only keyboard-backlight-test.sh is replaced by behavioural cases in quattro's brightness-keyboard-test.sh. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s record omacom#15908 replaced brightnessctl's save with a record taken at the first blank, which already keeps the level across a second blank after a resume. That is what the lock service's wake-instead-of-rearm change was for, and with the record in place a wake there no longer changes the keyboard, so that change is dropped along with the leds path override nothing reads any more. What quattro does not cover is omacom#10767: restore still puts the record back over a level the hotkeys set while blanked. restore now consumes the record without writing when the backlight is already lit, and the test for it moves into quattro's brightness-keyboard-test.sh. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… wake (omacom#15908) * Keep the keyboard backlight level across a second blank before a wake The lock blanks with `omarchy-brightness-keyboard off`, which saved the current level with `brightnessctl -s` before setting 0, and wakes with `restore`. Since the lock re-arms its blank timer after a resume (and when a screen arrives) without waking in between, a second blank saved the 0 the first one had set, and unlock restored 0. `off` now records the level only when nothing is already saved, and `restore` consumes it, so the level from before the first blank survives any number of blanks. Blank and wake run as separate processes, so both take a lock; a level that cannot be read is left lit, and a restore the device rejects keeps the level for the next wake. Co-Authored-By: Codex Medium <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * Treat an empty keyboard backlight record as no record, and test the lock A save that creates the record and then fails to write it, as a full runtime directory does, left an empty file. off checked only that the file existed, so it blanked anyway, and restore discarded the empty record without restoring: the keyboard stayed dark. off now removes a record it could not write and blanks only over a non-empty one, and an empty record left behind is replaced by the next off. The tests now hold a blank paused mid-save while a wake starts, which fails when the flock is removed, and check that a rejected restore leaves the backlight where it was. Co-Authored-By: Codex Medium <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * Check the blank over an empty record, and that the paused blank started Without the first check, a save guard that left an empty record in place passed: off skipped the blank and restore found the light still on. Without the second, a blank that never reached its save let the overlap test run restore first. Co-Authored-By: Codex Medium <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * Silence and reap the overlap test's background jobs docs/testing.md asks background fixtures to send their output elsewhere and be cleaned up on exit. The exit trap releases the paused blank and waits, since killing the backgrounded subshell would leave the script under it running against the deleted directory. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Omarchybot <[email protected]> Co-authored-by: Codex Medium <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> (cherry picked from commit 0c29fa5)
After a suspend from the lock screen, the keyboard backlight comes back at 0 on unlock, with no hibernate hook involved (#12994).
The lock blanks with
omarchy-brightness-keyboard offand wakes withomarchy-system-wake, which runsomarchy-brightness-keyboard restore.offusedbrightnessctl -s, which saves whatever the level is at that moment, then set 0. The lock re-arms its blank timer without waking in between in two places: after a resume it sees while the displays are off (thefingerprintResumeTimerbranch inshell/plugins/lock/Service.qml), and when a screen arrives (onScreensChanged). So lock, blank, suspend, resume and five seconds without input is a secondoffwhile the backlight is already 0, and it saves that 0 over the level the first one saved. Unlock then restores 0.offnow records the level in$XDG_RUNTIME_DIRonly when nothing is already saved, andrestoreconsumes the record, so the level from before the first blank survives any number of blanks before a wake. A backlight that was off before the lock stays off, and a wake with nothing saved (an idle cycle that ended before the lock) leaves the backlight alone instead of restoring an old level. Blank and wake run as separate processes, so both take a lock and each runs whole. A level that cannot be read is left lit rather than blanked with no record of it, and a restore the device rejects keeps the record for the next wake.This does not change the hibernate hook, which sets the backlight to 0 without saving it; #13729 and #14066 cover that. This fixes the backlight half of #12994 and does not close it: the keyboard-layout half is a separate question for the maintainer and is not touched here.