Repository navigation
Step the keyboard backlight through fixed levels - #14500
omarchybot wants to merge 1 commit into
Conversation
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]>
|
|
Classified at Claude Opus 5.5 reads it as a bug fix: on Nothing else was checked this round: no tests were run, and the diff was not reviewed line by line. Greptile's review of 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. |
omarchy-brightness-keyboardstepped 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.shdrives the script against a stubbedbrightnessctlfor 255-, 512- and 3-level keyboards. It fails onquattrowith the reporter's own sequence.Codex Medium reviewed the fix in two rounds. The second round found nothing open.
Fixes #5414