Can BetterDisplay run a command when I connect or disconnect a monitor?

Yes. Configure a connection event on that monitor using Control Integration. When BetterDisplay detects the connection change, the event can run a shell script, open a URL or send a macOS distributed notification.

  1. With the monitor connected, open Settings > Displays > [monitor] > Device Control > Add or Remove Controllers… and add Control Integration.
  2. In the Control Integration section, open Configure Events… and prepare a Hard reconnect or Hard disconnect event.
  3. 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.

Use hard events for a monitor that you plug in or unplug. Hard reconnect runs when BetterDisplay finds a remembered display again and sets up its controllers. Hard disconnect runs when an active display moves to the remembered list. Soft events run around BetterDisplay’s own connection attempts.

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 turns off software brightness upscaling. It enables or disables direct upscaling without setting a 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. The target display may not be ready when the event runs, especially if several displays reconnect together. The event runs once for the detected change. It does not keep checking the setup. See Control Integration and Events for timing and duplicate-action suppression, and Apple Display Preset for direct upscaling.