The `xrandr` utility can be used to configure outputs for X11 from the command line. For example, you can use it to configure and inspect resolution, position (relative to other monitors), rotation, scaling, refresh rate, DPI, and much more. It can even apply geometric transformations.
As an example, since I don't use a desktop environment, I have a script that detects when I connect/disconnect my laptop to/from its dock, and applies the appropriate monitor configuration.
@mikegerwitz ooh. Nice. I have a script which I manually invoke to swap monitor configs. Didn't think to poll for it. Thanks for the heads up.
For those who may be wondering: it's an X200, and the script simply polls /sys/class/drm/card0-HDMI-A-2/status.