Screen Brightness API shortcomings

Although I found examples on this website on how to change the brightness of the main screen, the methods used to implement that rely on the actions in KM which "increase" or "decrease" the brightness levels. There appears to be no way to "fetch" the brightness level for any screen, nor does their appear to be a way to "set" the brightness of the screen to a specific value, either using KM, AppleScript, or shell commands (without resorting to third party tools, which I won't do.)

You can't even adjust the brightness of a secondary (non-Apple) screen using System Preferences.

No doubt this is a limitation set by Apple because they didn't provide any public API for these functions.

There are some people online who provide an "ioreg command" which allegedly fetches the brightness level value of the main screen, but I couldn't get any of those commands to work on Sequoia. Has anyone been able to get this command to return the brightness level?

I'm mentioning this because I had decided today to write a macro which lets you set the brightness of the screen on a per-app basis. I did this once before with volume settings, but I'm hitting too many roadblocks when it comes to brightness settings. It looks like I won't be able to accomplish this goal.

Shortcuts can get and set the brightness by value. Not sure that it will necessarily work on external displays though. Been wishing for at least this much access to the keyboard backlight to no avail.

image

Which will include me, as in here. But when I was messing around with that the exact incantation did appear to be soft/hardware dependent so you'll have to do your own digging to find what works for you.

@hemicyon's Shortcut routine is the answer for internal (and, presumably, Apple external) displays. Others may be supported if you can change their brightness via the OS or the keyboard.

Thanks - I failed to think of Shortcuts. That should work for me.

Correct, the following ioreg command in your example returns an empty string on my Mac: (in fact, all 2033 lines of data returning from "ioreg" fails to return any occurrence of the word "Bright". So I don't know where to dig now.)