Skip to content

Step the keyboard backlight through fixed levels - #14500

Open
omarchybot wants to merge 1 commit into
quattrofrom
fix/issue-5414
Open

omarchybot wants to merge 1 commit into
quattrofrom
fix/issue-5414

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

omarchy-brightness-keyboard stepped by adding or subtracting a tenth of the keyboard's maximum from wherever the level stood. When the maximum is not a multiple of ten, the two directions land on different values. On a MacBook Air's 0–255 backlight the step is 25, so raising from off goes 25, 50 … 250, 255 (shown as 9%, 19% … 98%, 100%), while lowering from full goes 230, 205 … 5, 0 (90% … 1%). The two sequences in #5414 are exactly these. The lowest light could only be reached by turning the keyboard all the way up and coming back down without overshooting to off.

The keys now move between fixed levels: the raw values nearest 0%, 1%, 10%, 20% … 100% of the maximum. Up takes the next level above the current value, and down takes the next one below, so both directions use the same values. A value set some other way, by restore for instance, moves to the neighbouring level. Cycle steps up the same way and wraps to off from full. On keyboards with only a few levels the nearest values repeat, and since the comparisons are strict, a 3-level keyboard still steps 0, 1, 2, 3 as it did before. The OSD now rounds the percentage instead of truncating it, so these levels show as 1, 10, 20 … 100 rather than 9, 29, 49.

The 1% level is there because the report asks for a minimal setting that can be reached directly, and the old down-sequence was the only way to get one. It costs one entry in the level list. If the maintainer prefers plain tenths, drop it from that list.

test/shell.d/brightness-keyboard-steps-test.sh drives the script against a stubbed brightnessctl for 255-, 512- and 3-level keyboards. It fails on quattro with the reporter's own sequence.

Codex Medium reviewed the fix in two rounds. The second round found nothing open.

Fixes #5414

Adding and subtracting a tenth of max from wherever the level stood left up and down on different values whenever max is not a multiple of ten: on a 0-255 keyboard, up went 25, 50 ... 250, 255 (9%, 19% ... 98%) and down went 230, 205 ... 5, 0 (90% ... 1%), so the lowest light was reachable only by coming down from full. Stepping between the raw levels nearest 0%, 1%, 10% ... 100% lands both directions on the same values, keeps the minimal level, and rounding the OSD percentage shows them as 1, 10, 20 ... 100.

Fixes #5414

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Codex Medium <[email protected]>
@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Changes keyboard brightness stepping logic.

The PR appears safe to merge.

What we checked:

  • Cycle still reaches full brightness: The level list includes 100%. Cycle selects that level when below the maximum and wraps only when already at the maximum.

Summary

omarchy-brightness-keyboard now moves between shared fixed levels for up, down, and cycle. The displayed percentage rounds to the nearest whole number.

  • Adds tests for 255-, 512-, and 3-level keyboards.
  • Covers matching up/down levels, values between steps, endpoints, and cycle wrapping.
  • No actionable issues found.

Reviews (1) · Last reviewed commit: "Step the keyboard backlight through fixe..." · Reviewed by Greptile

@omarchybot

Copy link
Copy Markdown
Collaborator Author

Classified at 8665691 by Claude Opus 5.5 and Codex Medium separately, and the two disagree, so this carries no class label and was not verified on a worker this round.

Claude Opus 5.5 reads it as a bug fix: on quattro, omarchy-brightness-keyboard steps by a tenth of the maximum from wherever the level stands, so on a 0–255 backlight raising and lowering land on different values, exactly the two sequences in #5414. Codex Medium reads it as an enhancement. Beyond making the two directions agree, the change adds a 1% level that was never a step before and makes the OSD round the percentage rather than truncate it; both are deliberate behaviour changes, and they are where the two readings part.

Nothing else was checked this round: no tests were run, and the diff was not reviewed line by line. Greptile's review of 8665691 raised nothing.

This waits on the maintainer: whether the fixed levels, the 1% step included, are the fix for #5414 or a new behaviour to decide on first. Once that is settled it can be verified and reviewed.

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.

Keyboard backlight settings inconsistently jump in steps of 9 or 10

1 participant