If it's connected via HDMI you can actually do that. There's a package called ddccontrol. For example, here is my code to toggle my 4th monitor between hdmi and displayport (hooked up to desktop or hooked up to a client laptop - this also switches out my synergy config at the same time later in the toggle script).