I'm just switching over to KeyboardMaestro from Autohotkey on Windows and I really love the GUI. I've been able to work out so much of the stuff on my own, it's great!
One thing I'm struggling with is the 'The power status changes' trigger.
I'm trying to replicate something I had in Autohotkey:
When the charger is unplugged, screen brightness is set to 50%.
When the charger is plugged in, screen brightness is set to 90%.
At the moment, I've only been able to get random increases or decreases, because I don't fully understand the trigger.
Can anybody help a new user out? I'd be very grateful for any advice.
How would I do that? I'm confused about the triggger.
It says 'The power status changes', so I'm not sure how to set up decrease on unplug and increase on plug in. I can only figure out how to make it go one way, if that makes sense.
Hmm.... you might want to double check that the path is correct by running this command in Terminal:
echo $PATH | sed 's/:/\n/g'
That will produce a list of anywhere custom scripts are installed. On my iMac it looks like this:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
Copy those into your ENV_PATH variable separated by a colon. On my iMac it looks like this (there are extra paths because I also have Homebrew on my MacBook and use the same ENV_PATH variable for both machines):
As @cdthomer writes your ENV_PATH should include all the paths from which you want to run shell scripts commands.
You could also reference the commands path directly in the Execute Shell Script action.
But first you need to find where brightness is installed.
You can use this command which brightness.
On my system it returns /usr/local/bin/brightness.
So the command could be /usr/local/bin/brightness 1
I prefer to add my paths to the ENV_PATH, so normally a command which works in the terminal works in KM.
Hi @HopelesslyConfused. (Nice username, BTW.) This won't specifically address the trigger issue you mentioned, but regarding the brightness adjustment, you could borrow some actions from this macro Toggle Brightnessavailable here.
Thanks for all the help. I used echo $path | sed 's/:\/n/g' to find all of the paths where scripts are installed, and then added it to my ENV_PATH variable, separated by colons.
Still no dice though. When I click the 'Settings Cog - Try Action' option under the brightness value actions in the script, nothing happens, so maybe there is a different problem?
So to use Brightness it seems you need to install it from source.
The instructions below is taken from the github page for the project.
I have never installed anything like this from source, so I do not know where the command gets installed.
Install From Source
git clone https://github.com/nriley/brightness.git cd brightness make sudo make install
Hmm, that didn't work either, but I did manage to modify the macro posted by @_jims to work with the changed power state setting. If anyone else wants to use it, here it is! You can change your dim setting and bright setting by hitting Option-Command-H.
Hi @HopelesslyConfused, I decided to start with Toggle Brightness and create a new macro with several enhancements including automatic adjustment for power transitions: Charger to Battery and vice versa.
I recommend you use the new macro as it likely has some other features you will find useful. In addition it has been much more thoroughly tested. Frankly, Toggle Brightness was slapped together and had a few rough edges. I've officially declared it superseded in the thread where it was posted.