Add brightness presets and a monitorcontrol:// URL scheme - #1892
Open
Erik5000 wants to merge 3 commits into
Open
Add brightness presets and a monitorcontrol:// URL scheme#1892Erik5000 wants to merge 3 commits into
Erik5000 wants to merge 3 commits into
Conversation
MonitorControl can set an absolute brightness from the menu slider only. The slider path also skips the OSD and the brightness sync bookkeeping, so it is not reusable. Add BrightnessActions with two entry points, setLevel and changeLevel. Both perform the same side effects as a brightness key press: they show the OSD, move the menu slider, and update brightnessSyncSourceValue. The last one matters. AppDelegate.job() compares the live brightness of an Apple display against that value. A stale value makes the sync push the difference to every other display. The relative entry point does its arithmetic per display. An outside caller therefore never needs to read the current level first. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
MonitorControl has no way for another app to change the brightness. The only absolute path is the menu slider, which needs a mouse. Add a URL scheme on top of the shared action layer: monitorcontrol://brightness/set?value=10 monitorcontrol://brightness/set?value=10&display=all monitorcontrol://brightness/change?delta=-10 Values are percentages. The app does the arithmetic for a relative change, so a caller never has to read the current level. This matters: many monitors accept DDC writes but return noise on reads. Any app can open a URL, so there are two limits. The disableExternalControl preference switches the scheme off. A 1% floor stops a URL from making a screen fully black. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Erik5000
force-pushed
the
feature/brightness-presets-and-url-scheme
branch
3 times, most recently
from
August 12, 2026 07:19
c910a72 to
cbc6d5a
Compare
MonitorControl can step the brightness up and down, but it cannot jump to a level. Users ask for this often, most recently in MonitorControl#1851 and MonitorControl#1674: a key that dims every screen when they leave the desk, and a key that puts the screens back. Add four presets. Each one has a percentage the user sets and a shortcut the user records. A preset always changes every display, because a scene that reached only the display under the pointer would be of little use. The presets stay active whichever way the brightness keys are set. Most users keep the media keys, and a preset must still work for them. The rows are built in code, not in the storyboard. Every storyboard label needs an entry in 19 Main.strings files keyed by object id. In code the new text lives in Localizable.strings only. The percentage box saves while it is typed. An NSTextField sends its action on Return only, so a level that was typed and left uncommitted would never reach the settings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Erik5000
force-pushed
the
feature/brightness-presets-and-url-scheme
branch
from
August 12, 2026 07:23
cbc6d5a to
dc7ee4c
Compare
Member
|
No worries. I'll not close this but not merge it either, just keep it open with a label for visibility if one needs this specific feature and would like to get to the fork. :) |
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.
What this adds
Two related things, in three commits that can be taken separately:
you record. A preset sets every display to that level.
monitorcontrol://URL scheme, so a script or a launcher can do thesame thing.
Both go through one small shared file,
BrightnessActions.swift, so the twoentry points cannot drift apart.
Why
The most common request I could find in this repo is a key that dims every
screen when you leave the desk, and a key that puts them back: #1851, #1674,
#727, #795, #1224. Related asks for outside control: #682, #1515, #1620, #1858.
I understand the answer has been that MonitorControl stays simple, and that
BetterDisplay covers this. I still think this specific shape is small enough to
fit: it adds no new window, no new tab, and nothing changes for a user who
never records a preset shortcut.
Please close this if you disagree. I will keep using my fork and I will not
argue the point.
Design notes
Display.setBrightnessalready existed and already picks DDC, the Appleprotocol, gamma, or the shade layer. Nothing in that path is touched.
stepBrightness: the OSD,the menu slider, and
brightnessSyncSourceValue. The last one matters,because
AppDelegate.job()compares against it and a stale value makes thesync push the difference to every other display.
caller therefore never has to read the brightness first. Many monitors accept
writes but return noise on reads.
keep the media keys, and a preset must still work for them.
text in
Localizable.stringsonly instead of 19Main.stringsfiles.disableExternalControlswitches the scheme offand a 1% floor stops a URL from making a screen fully black.
Testing
Built and run on macOS 26.5.2, Apple silicon, with 4 external displays
(3x LG UltraFine, 1x N27p) in clamshell mode. Two of those monitors accept DDC
writes but return noise on reads, which made them a useful test.
Checked: absolute set, relative change, all four displays reaching the target,
the OSD, the menu sliders, the brightness sync not fighting the change, the 1%
floor, the off switch, and malformed URLs (
value=abc,value=999, unknownaction) being ignored without a crash.
The diff carries no SwiftFormat churn and no
CFBundleVersionbumps.Disclosure
This was written with AI assistance (Claude). You said on 2026-05-09 that you
do not review AI generated PRs, and asked to be told. So: this is one. I am not
asking you to make an exception. If the
AI contribution / fork recommendationlabel is the right home for it, that is completely fine, and the fork is at
https://github.com/Erik5000/MonitorControl for anyone who wants the feature.
Every line was read, built, and tested on real hardware before opening this.