Skip to content

Fix keyboard backlight restore after screensaver dismiss - #10366

Open
marcindyguda wants to merge 1 commit into
omacom:quattrofrom
marcindyguda:fix/keyboard-backlight-stale-restore
Open

Fix keyboard backlight restore after screensaver dismiss#10366
marcindyguda wants to merge 1 commit into
omacom:quattrofrom
marcindyguda:fix/keyboard-backlight-stale-restore

Conversation

@marcindyguda

Copy link
Copy Markdown

Problem

After the screensaver shows and is dismissed (before the lock deadline), the keyboard backlight stays dark instead of keeping its previous brightness.

Root cause

  • Lock blanking (shell/plugins/lock/Service.qml blankProcess) runs omarchy-brightness-keyboard off = brightnessctl -s set 0 (save + off).
  • Wake (bin/omarchy-system-wake) runs omarchy-brightness-keyboard restore = brightnessctl -r.
  • But screensaver dismiss (shell/plugins/services/idle/Service.qml cancelIdleCycle) also runs omarchy-system-wake without any preceding off, so restore applied a stale save (often 0 from an earlier cycle) and clobbered the still-lit keyboard. A repeated off while already at zero had the same clobbering effect on the save file.

Reproduced live on a MacBook (kbd_backlight, max 255): stray restore with no preceding off reset a lit keyboard to the stale saved value.

Fix

bin/omarchy-brightness-keyboard now pairs off/restore with a marker file (${XDG_RUNTIME_DIR:-/tmp}/omarchy-keyboard-backlight-off):

  • off only saves (-s) when the keyboard is actually lit; a repeated off at zero is a plain set 0 that leaves the save intact.
  • restore is a no-op without the marker (screensaver dismiss), one-shot (clears the marker), and leaves an already-lit keyboard alone.

No caller changes needed; omarchy-system-wake keeps calling restore.

Verification

  • New test/shell.d/keyboard-backlight-test.sh passes; idle-test.sh passes (bin-style-test.sh failure is pre-existing on clean checkout, unrelated omarchy-remove-ai-openclaw).
  • Live check: 25 -> off -> 0 (marker) -> restore -> 25 (marker cleared); stray restore on a lit keyboard is a no-op.

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.

1 participant