Skip to content

Automatic keyboard lighting from the ambient light sensor - #14517

Closed
maralcbr wants to merge 2 commits into
omabot/pr-13362from
keyboard-auto-lighting
Closed

maralcbr wants to merge 2 commits into
omabot/pr-13362from
keyboard-auto-lighting

Conversation

@maralcbr

@maralcbr maralcbr commented Oct 8, 2026

Copy link
Copy Markdown
Member

Split out of #14431 so it gets its own review: automatic keyboard lighting is a new feature on every laptop with an ambient light sensor and a keyboard LED, not something Apple hardware needs to run Omarchy.

Stacked on #14431 (base omabot/pr-13362), so the diff shows only this feature.

What it does

First run enables omarchy-brightness-keyboard-auto as a user service. It lights the keys in a dark room and dims them as the room brightens. The brightness keys and firmware keys (such as Fn + Space) still choose by hand, and automatic control resumes when the ambient light moves enough that the old choice no longer fits. It pauses while the screen is locked or the lid is closed; keys the lock screen blanked light up again with the room. Machines without the sensor or the LED never start it.

The first commit brings the feature back as it was in #14431. The second fixes a race found in review:

  • The lock screen's blank waited two seconds for the keyboard lock, then went ahead without it. The loop's lid check, made while holding that lock, can itself take two seconds when logind stalls, so the update could light the keys again while the screen stayed locked. A brightness key that timed out went ahead the same way.
  • The blank and the wake restore now wait for the lock however long it's held, and a key that can't get it in two seconds changes nothing. The loop asks about the lid before taking the lock, and a session check that doesn't answer within a second is killed and counts as locked.

Testing

test/shell.d/brightness-keyboard-auto-test.sh (30 checks, including a blank outlasting the old two-second wait, the lid check outside the lock, a hung session check and a key that times out) and systemd-test.sh pass in an Arch Linux ARM container. Not tested on hardware.

Brings back automatic keyboard lighting, split out of omacom#14431 so it gets its own review: laptops with an ambient light sensor and a keyboard LED light the keys in the dark and dim them as the room brightens, and the brightness keys and firmware keys still choose by hand.
The lock screen's blank waited two seconds for the keyboard lock, then went
ahead without it. The automatic loop's lid check, made while holding that
lock, can itself take two seconds when logind stalls, so the blank could land
first and the update light the keys again while the screen stayed locked. A
brightness key that timed out went ahead the same way.

The blank and the wake restore now wait for the lock however long it is held,
and a key that cannot get it in two seconds changes nothing. The update keeps
the lock short: it asks about the lid before taking it, and a session check
that does not answer within a second is killed and counts as locked.
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed the separate keyboard-lighting scope with Claude Opus 5.5 High via Pi. A stale idle-wake restoration could leave the keys lit after an observed manual or firmware off; the carried changes preserve that choice and enable the service for existing users as well as first-run. Those cases were reproduced on an isolated ISO worker, and the keyboard, systemd and current-package contract tests pass.

One defect remains: password unlock can call restore several times before the ambient loop observes a recent manual level, losing that choice. This feature remains a draft pending a correction that also preserves hibernate restoration. The review stopped at its three-round bound. Both settings recipes already ship the unit when present, so the packaging concern based on an older checkout was rejected.

GitHub rejects the bot's push to omacom/omarchy-mac with 403. The replacement preserves @maralcbr's commits unchanged and carries the contained fixes on top, keeping this scope out of #14431.

Continued in #14557.

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.

2 participants