Skip to content

Resume keyboard backlight after suspend and unlock - #697

Open
calamrc wants to merge 1 commit into
omacom:quattrofrom
calamrc:fix/keyboard-backlight-resume-pause
Open

calamrc wants to merge 1 commit into
omacom:quattrofrom
calamrc:fix/keyboard-backlight-resume-pause

Conversation

@calamrc

@calamrc calamrc commented Oct 6, 2026

Copy link
Copy Markdown

Summary

omarchy-brightness-keyboard-auto treats every unexpected keyboard-LED write as a manual brightness-key press, then holds that level until ambient light moves by at least 20 lux. Suspend (and the lock that wraps it) brings the Apple keyboard controller back at 0. In a dark room the sensor stays at 0 lux, so the pause never clears and the keys stay off.

This forgets the saved level in two cases that are not a key press:

  • the screen is locked or the lid is closed
  • the gap since the previous poll is longer than three poll intervals, which is what suspend looks like to a frozen process

A brightness-key change between normal 5 second polls still pauses until the room light moves.

Seen on an M2 MacBook: the user service had been running since boot, the machine had suspended, the ambient sensor read 0 lux, and kbd_backlight stayed at 0 until the service was restarted.

Test plan

  • bash test/shell.d/brightness-keyboard-auto-resume-test.sh
  • bash test/shell.d/brightness-keyboard-auto-test.sh
  • On a MacBook, suspend in a dark room and unlock: the keys come back on without restarting the user service
  • Shift+Brightness in steady light still holds until the room light changes

A write while the screen is locked, the lid is closed, or the process
was frozen by suspend is not a brightness-key press. Forgetting the
manual pause in those cases lets a dark room light the keys again.
A real key change between normal polls still holds until the room
light moves.

This branch has not been deployed

No deployments
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