DisplayWatcher is a macOS application that helps you change your Dock (and other) settings automatically when you plug or unplug an external monitor by invoking AppleScript upon display changes. It can also run scripts on wake (handy for SSH tunnels).
