Screen Brightness Action Problems

I wrote a macro to change / control the brightness of my monitor but it is not working (i.e., the brightness is not changing).

I tested the functionality / logic and noticed:

  1. The macro triggers are firing properly.

  2. The engine log was recording the event with multiple entries that read "2026-06-08 06:49:59 Execute macro “Single Brightness Action” from trigger Editor" with no error codes.

I then decided to get as basic as possible and built the below single action macro:

Single Brightness Action.kmmacros (23.3 KB)

I noticed that when I execute the macro that the screen brightness does not change! I would greatly appreciate:

  1. An explanation as to why the action is not working (i..e, is something broken); and

  2. Someone else testing it to see whether the problem is with my system or elsewhere as I see no reason why it would not work.

I do note that I am able to change the brightness from the keys on my Apple Keyboard.

Much thanks,

No idea -- but since the keystroke works, try simulating that instead:

While the Wiki says the failing Action is the same as pressing the hardware key, it's worth a check with the simulated key press.

@Nige_S

Great idea, unfortunately no joy, it still does not work.

I know that we are running different chipsets and macOS versions, but does it work on your end?

Thanks.

PS. If someone on Apple silicon and Tahoe could test this and share heir results I would be most appreciative.

M2 here but on Sequoia. I can only get it to work (and it did work, as did Decrease Screen Brightness) in the Keyboard Maestro editor when I tap the Run button because it appears you didn't assign any trigger to it at all.

How are you triggering it?

Appreciate you confirming that it works for you [and yes, by pressing the Run button]. I need to figure it out why it is not working for me.

Anyone on Tahoe who can try?

I have to say the screen display of the brightness bar is a bit confusing. At first I thought it wasn't working because nothing changed (not brighter, not more bars) but I was already at 100 percent brightness. Which is why I tried the Decrease action.

@mrpasini appreciated, hopefully @peternlewis will chime in later in the day.

As noted the action is equivalent to the Simulate Hardware Key action pressing the key (optionally with the optionKey+shiftKey for quarter increase/decrease).

I tested it and it works fine on my MacBook running Tahoe.

It's interesting that it works with the actual keystroke but not the simulated keystroke - that makes me wonder if there is something on your Mac that is either implementing those keys specifically or interfering with the simulated keys.

You could try rebooting in Safe mode and seeing if that changes the behaviour, either of the physical keys or the Keyboard Maestro actions.

I am now truly baffled and would appreciate the assistance of the Keyboard Maestro brain trust:

  1. The decrease / increase brightness actions (image 1) and simulate hardware key brightness down / brightness up actions (image 2)

    a) work with the built-in display and an external ViewSonic display

    b) do not work with the Apple Studio Studio

image 1

image 2

  1. The decrease / increase brightness keyboard buttons on my Apple keyboard:

    a) work with the built-in display and an external ViewSonic display

    b) work with the Apple Studio Studio

  2. The decrease / increase brightness Terminal commands (image 3) also

    a) work with the built-in display and an external ViewSonic display

    b) work with the Apple Studio Studio

Image 3

While I am far from an expert it appears (based on the above) that there is problem with the Apple Studio Display and in this regard:

a) Are you in agreement with my conclusion?

b) Is there a way that we can test this?

c) Is there anyone else on the forum with a 2026 Apple Studio Display that can test whether the Keyboard Maestro actions on their display?

d) What is different about the code behind the Keyboard Maestro actions that it does not work whereas the keyboard buttons and teh Terminal commands do work. @peternlewis, can you chime in here please?

Looking forward to the responses and much thanks.

I have an Apple Studio Display, but I can't really answer this since:

  • My keyboard does not have brightness buttons.
  • The Simulate Hardware keystroke doesn't work
  • The Brightness actions don't work
  • The AppleScript code tells me neither Script Editor nor Terminal are allowed to send keystrokes

This is all on Sequoia not Tahoe.

Peter, good afternoon and much thanks.

Although I may be mistaken, it does appears that you have answered my main concern that there was something wrong with my Apple Studio Display monitors. The fact that you are getting the same results (Brightness actions and Simulate Hardware keystroke do not work) suggests that this is an Apple Studio Display design issue that is not unique to my displays. Should you disagree, please let me know.

Can you please expand on how you concluded and what you mean by the "AppleScript code tells me neither Script Editor nor Terminal are allowed to send keystrokes" other than the obvious (i.e., Script Editor says you cannot do it).

It is fair or reasonable to conclude that whatever is blocking Script Editor and Terminal from sending keystrokes is similarly blocking teh Keyboard Maestro actions?

That said, it is curious that the brightness buttons work!

These are AppleScript commands, so try them as plain AppleScript in an "Execute an AppleScript" Action and also the osascript version you posted in an "Execute a Shell Script" Action. If either of those work, that'll be your workround.

But this certainly seems like a Studio Display issue, not a KM one. Has this ever worked for you? If so, what's changed since? Are you still running other utilities that faff with your Studio Display, and might they be interfering?

Appreciate the suggestion (though I am still interested in what Peter found that says that AppleScript commands cannot be sent).

It is strange but the AppleScript commands that I posted in Image 3 above work perfectly when run in a Keyboard Maestro Execute AppleScript action, both the increase (key code 144) and the decrease (key code 145).

The question is, why do the Keyboard Maestro Brightness actions and Simulate Hardware keystroke actions not work? Hopefully Peter can assist.

Yes, I recall it working with my previous Apple Studio Display but not the new one, that is all that has changed.

Yes, I do have other software but I stripped it out when I had the problem to make sure it was not the other software, same problem so not the other software.

As always, thank you!

Me too -- and the fact that brightness can be controlled by AS indirectly from KM could be another useful data point.

That's quite a big "all"! :wink: And another useful data point.

It will also be interesting whether these data points will result in a fix to the Keyboard Maestro actions. It will likely have to wait until tomorrow given the time difference, it is now evening for Peter.

Agreed, it was a big purchase that I stressed over! :thinking:

tell application "System Events" to key code 145

(or the equivalent run via osascript).

Gives an error like:

36:48: execution error: System Events got an error: osascript is not allowed to send keystrokes. (1002)

No, because I know the Volume Up/Down actions (which work the same way) work fine as I use them all the time.

Except I have two monitors (the other being an LG) and neither of them are affected.

Confused and interesting at the same time that I am not getting any error messages. I just ran it again and got no error message in either the Editor log, Engine log, or Terminal (the I run it outside of Keyboard Maestro).

Apologies and fair, I should have been more precise.

I should have written, It is fair or reasonable to conclude that whatever is blocking Script Editor and Terminal from sending keystrokes to control the brightness (in your case) is similarly blocking the Keyboard Maestro brightness actions?

Hmmm, I wonder whether the culprit is displays that connect as Apple Native (i.e., DisplayServices) rather than DDC? How does your LG display connect?

Would love to figure this out -- just curious, even though I do have a workaround.

Thank you!