Can BetterDisplay run a command when I connect or disconnect a monitor?
Yes. Configure a connection event on that monitor using Control Integration. Its action can run a shell script, open a URL or send a macOS distributed notification when BetterDisplay observes the relevant transition.
- With the monitor connected, open Settings > Displays > [monitor] > Device Control > Add or Remove Controllers… and add Control Integration.
- In the Control Integration section, open Configure Events… and prepare a Hard reconnect or Hard disconnect event.
- Select Run shell script and enter the command, using explicit executable paths. Event edits save immediately. Keep Do nothing selected until the command is ready.
For a complete fixed-brightness example with manual testing and cleanup, follow Run desk setup actions when a monitor reconnects.
Hard reconnect means a remembered display is rediscovered and its controllers are set up. Hard disconnect means an active display becomes a remembered display. Soft connection events are separate hooks around BetterDisplay’s own connection attempts. Choose the event that matches the transition you need.
For example, on a MacBook with supported Direct XDR Upscaling, a hard-reconnect event on the desk monitor can turn that feature off on the built-in display:
/Applications/BetterDisplay.app/Contents/MacOS/BetterDisplay set -name="Built-in Display" -directBrightnessUpscaling=off
A hard-disconnect event can run the same command with on instead of off. Replace the display name with the actual built-in display’s name. Direct upscaling requires a connected, compatible built-in display and Pro. The event editor itself has no separate Pro requirement. The command also disables software brightness upscaling, so it is not a way to preserve a separate software-upscaling setup. It changes whether direct upscaling is enabled, not a requested numeric nits limit.
Use explicit on/off states rather than toggles so repeated events keep the intended state. Test reconnecting the monitor and waking the Mac with your normal arrangement. Other transitions may happen at the same time, and the target display may not yet be ready for the command. An event runs when BetterDisplay observes the transition. It does not continuously check your setup. See Control Integration and Events for timing and duplicate-action suppression, and Apple Display Preset for direct upscaling.