Skip to content

Put brightness on a shortcut - #52

Merged
ishanmalu merged 1 commit into
mainfrom
brightness-shortcuts
Sep 4, 2026
Merged

ishanmalu merged 1 commit into
mainfrom
brightness-shortcuts

Conversation

@ishanmalu

Copy link
Copy Markdown
Owner

nudgeAll() has been in Brightness.swift since 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 release clean, no warnings
  • --selftest: 150 checks, all pass
  • The existing duplicate-binding check confirms = and - were free and that the two new bindings do not collide

Site

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.

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.
@ishanmalu
ishanmalu merged commit 1827bbc into main Sep 4, 2026
1 check passed
@ishanmalu
ishanmalu deleted the brightness-shortcuts branch September 4, 2026 19:13
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