MACRO: Brightness Control, v1.1


PURPOSE

The purpose of this macro is provide an easy method to switch between two adjustable Display Brightnesses: Dim and Bright

  • If the Primary Hot Key (⌃⌘B) is pressed, the Brightness will be toggled: Dim to Bright or vice versa

  • If the mac transitions from Charger to Battery, the Brightness will be set Dim.

  • If the mac transitions from Battery to Charger, the Brightness will be set Bright.

The Dim and Bright settings, ranging from 0 to 100, can be adjusted using a dialog that is displayed two ways:

  1. Using a Secondary Hot Key that includes ⌥(Option key). The default is: ⌃⌥⌘B

  2. Forcing a transition from Dim to Bright within 3 seconds of a transition from Bright to Dim. This can be done using the Primary Hot Key and/or power transitions.


SETTINGS

By default, during power transitions, this macro will change the Display Brightness as described above. Either or both transitions can be ignored using these settings:

Bright on Charger : 1 = yes; 0 = ignore
Dim on Battery : 1 = yes; 0 = ignore

By default, a low volume sound, Sosumi, will be generated before the macro dialog is displayed. This can be disabled with the following setting:

Dialog Sound Alert : 1 = yes; 0 = disable


IMPLEMENTATION NOTES

  • This macro uses native Keyboard Maestro actions to control the brightness. Since there is no action to set the brightness to a specific value—likely because macOS does not provide a Public API, it calculates the number of brightness increases from zero brightness and rapidly steps the brightness to the specified value (0 to 100).

  • This macro is a superset of Toggle Brightness, available here. If you downloaded that macro and plan to use this one, delete or disable Toggle Brightness as the two use the same Hot Keys. Toggle Brightness will no longer be updated.


TESTED WITH

• Keyboard Maestro, v10.0.2
• Monterey, v12.3.1/MacBookPro16,1
• Mojave 10.14.16/Macmini6,2
• High Sierra 10.13.6/iMac11,1445


VERSION HISTORY

1.0 - initial version
1.1 - a) One of the two methods of displaying the adjustment dialog is by forcing a transition from Dim to Bright within 3 seconds of a transition from Bright to Dim. In this version this default time window was reduced from 10 to 3 seconds. This can be adusted using local_AutoDialogWindow. b) Minor changes to the macro DESCRIPTION.


DOWNLOAD Macro File:
Brightness Control.kmmacros (103 KB)
Note: This macro was uploaded in a DISABLED state. It must be ENABLED before it can be run. If it does not trigger, the macro group might also need to be ENABLED.

Macro-image


Note that this macro will automatically adjust the display brightness when transitioning* to a battery or to a charger.

* Either or both of these transitions can be ignored using macro settings. If you do have another macro that adjusts the display during that transitions, I suggest you disable all but one. It gets very confusing if two or more are concurrently enabled. (I speak from experience!)

1 Like

I've updated the OP with Version 1.1 of Brightness Control:

  • One of the two methods of displaying the adjustment dialog is by forcing a transition from Dim to Bright within 3 seconds of a transition from Bright to Dim. In this version this default time window was reduced from 10 to 3 seconds. This can be adusted using local_AutoDialogWindow.

  • Minor changes to the macro DESCRIPTION.

1 Like