Turn Screen Brightness to 0 if External Monitor Connected?

As title says,
Want to create a macro to turn screen brightness to 0 when external monitor connected.

Even if external monitor connected cannot be set as trigger, at least could you help me find a way to turn screen brightness to complete 0

Thanks in anticipation

Hey @forums2012,

Keyboard Maestro can increment the increase or decrease in brightness of the main screen, but I believe that's it.

If you want more control then you'll have to resort to scripting, and you'll have to use a 3rd party utility.p

In this case the brightness command line utility looks like the best option.

It can be installed with either MacPorts or Homebrew.

Here are fairly detailed instructions on installing Homebrew and then using it to install apps:

Installing a Unix executable with Homebrew

I use MacPorts instead of Homebrew (although I think hb is easier for most folks to manage), and I installed the brightness command line app with it.

It works perfectly on my Mid-2010 17" MacBook Pro, but I don't currently have a multi-monitor setup to test secondary monitors with.

That said I see no reason offhand why brightness would fail to work with them.

-Chris

Awesome!
Thanks a lot.
That solves the 2nd part of the question.
Is there a trigger for External Display connected. I see a USB device trigger, there must be a way.
Thanks

Hey @forums2012,

No.

But you can use a Set Variable to Calculation action do something like this:

image

-Chris

hey @ccstone, I've installed brightness with HomeBrew and its working fine inside terminal, but when i try to run it in a shell script action in KM 9, it says "command not found". Sorry, I'm not used to installing command line tools like this so don't know it it's something obvious or just a bug in the latest KM.
TIA

You need to use either the full path or set the PATH environment variable.

Select Help from the Gear menu in the Execute a Shell Script action and look at the PATH section.

Thanks @peternlewis, it works when setting the ENV_PATH.

1 Like

Hey @JeffLambert670, I've installed Homebrew and Brightness on my Mac running Catalina. I'm trying to execute a Shell script in KM to change the brightness of my screen.

Would you mind typing out what you put in the shell script box to make it work for you? I'm just a regular guy who doesn't know code. I tried just typing "brightness .5" like I do in Terminal, but that produces error. I tried looking in the Gear menu for the PATH section, but couldn't find anything for "PATH". I'm also not sure what setting the "ENV_PATH" is.

I appreciate the help!

hey @schop, my script to set my macbook pro brigthness to 100% is just. Change the 1.0 value to 0.5 if you want it hat 50%. I don't remember what the -d is doing though. HTH.

brightness -d 1 1.0