Toggle Screen Brightness From Brightest to Dimmest?

Every night before I go to bed, I dim my iMac's screen to the dimmest setting and set the sound volume to mute. I found the toggle mute feature, but I can seem to find any way to set the screen brightness to the dimmest setting. There are macros for incremental dimming, but I'm looking for a way to write a macro that toggles the brightness on and off to go along with the mute sound settings. I don't want my iMac to sleep during this time due to having processor-intensive backups running (BackBlaze). Is there an easy solution to put the toggle brightness and toggle sound under a single keystroke?

Can you repeat this action:

Set the largest number that is needed.

1 Like

I thought of that, but I'm hoping to find a toggle solution so that when I hit the key again, it brings the brightness back to full. Hoping the developer could add a toggle feature where you can set the minimum/maximum numerically. Like the dimmest setting = 0 and brightest setting = 10. Thank you though. I'm also looking at a third-party solution where I can just have KM control that if the third-party app lets you set keystroke commands, but having it all in KM would be ideal.

This seems to do exactly what you want:

1 Like

I actually thought I had it just through an Apple keyboard command. When you press control-shift-eject, it turns the monitor completely to black. But apparently there's no way in KM to use the eject key as a modifier.

The command line brightness as suggested by @martin looks like your best option.
You can get the current brightness using the -l option:
brightness -l

You can put this in a KM Execute a Shell Script action and return to a KM Global Variable, say DND__PriorBrightness
Then when you want to restore the brightness, use this KM Variable in another Shell Script:

brightness $KMVAR_DND__PriorBrightness
1 Like

@jamesharrisphoto, you could combine the actions from these two or create a simple third macro with two Trigger Macros by Hot Key actions.

Note that both will install in the disabled state.

Toggle Brightness.kmmacros (16 KB)

Image (Toggle Brightness)

Toggle Volume.kmmacros (16 KB)

Image (Toggle Volume)

That's the built-in shortcut for display sleep.

Use a Device Key trigger instead of a Hot Key trigger to use the Eject key. As an example: image

I've made a small refinement to Toggle Brightness and Toggle Volume macros and posted the updates here.

If either macro is triggered with the ⌥ (Option key) down, a dialog will open providing a method to change the bright and dim (or loud and soft) settings. In the revised macros, the default buttons in the dialogs adjust based on the current brightness (or volume).