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:
-
Using a Secondary Hot Key that includes ⌥(Option key). The default is: ⌃⌥⌘B
-
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:
local_BrightOnCharger : 1 = yes; 0 = ignore
local_DimOnBattery : 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:
local_DialogSoundAlert : 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 10.2
• Sonoma beta 14.1 (23B5067a)/MacBookPro16,1
• Mojave 10.14.16/Macmini6,2
• High Sierra 10.13.6/iMac11,1445
VERSION HISTORY
( expand / collapse )
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.
1.2
a) Add additional information to the dialogs.
b) Simplified the elapsed time calculation.
c) Persistent settings are saved to a dictionary rather than global variables.
Download: Brightness Control.kmmacros (100 KB)
Macro-Notes
- Macros are always disabled when imported into the Keyboard Maestro Editor.
- The user must ensure the macro is enabled.
- The user must also ensure the macro's parent macro-group is enabled.
System Information
- macOS 14.1 (23B5067a) PRE-RELEASE SEED SOFTWARE
- Keyboard Maestro v10.2
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!)