Repository navigation
Put brightness on a shortcut - #52
Merged
Merged
Conversation
nudgeAll() has been in the app since brightness control was added, with no callers anywhere. It was written to be driven by a keyboard shortcut and the shortcut was never registered, so the code sat there unreachable. It is wired to ⌃⌥= and ⌃⌥- now. Both move every display a sixteenth at a time, which is the step macOS itself uses, so they feel like the keys next to them — except these also reach external monitors, which the Mac's own brightness keys never do. Where there is no backlight to control Perch dims with an overlay, so the same shortcut works on any display. Stepping down used to be able to land on zero. A screen at full black has no visible slider to bring it back, so the floor is now one step above zero, and a display already sitting at zero comes back up rather than sticking there. The clamping is extracted as a static function so it can be checked without a display attached; four cases added to the self-test. The existing duplicate-binding check covers the two new keys, and confirms = and - were free. The site's brightness caption read "in the panel" because there was no shortcut to name. It names these.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
nudgeAll()has been inBrightness.swiftsince brightness control was added, with no callers anywhere in the source. It was written to be driven by a keyboard shortcut, the shortcut was never registered, and nothing ever called it.What the shortcuts do
⌃⌥=and⌃⌥-move every display one sixteenth at a time.The sixteenth is deliberate — that is the step macOS itself uses, so these feel like the keys next to them. The difference is reach: the Mac's own brightness keys only ever touch the built-in panel, and do nothing for an external monitor. These move all of them. Where there is no backlight to control, Perch dims with the overlay it already uses, so the same keypress works on any display.
A brief readout shows the resulting level, and both are rebindable in Settings like every other shortcut.
One bug fixed on the way
Stepping down could land on zero. A screen taken to full black has no visible slider to bring it back, which is a trap rather than a feature. The floor is now one step above zero, and a display already sitting at zero comes back up rather than sticking there.
The clamping is extracted as
BrightnessController.stepped(_:by:)so it can be checked without a display attached — four cases added to the self-test.Verified
swift build -c releaseclean, no warnings--selftest: 150 checks, all pass=and-were free and that the two new bindings do not collideSite
The brightness caption read "in the panel" because there was no shortcut to name. It names these now, and the shortcuts table has a row for them.