How to get external monitor to reconnect after sleep or power off

Problem:
On an Ubuntu based laptop, when I sleep or disconnect power to my external monitor then power up the system or reconnect the monitor again, the display doesn't come on.

Poor man's solution:
The only way I've found to get the external display to work (aside from reboot) is to switch from Joined Display to Mirror Display. As soon as the monitor comes alive I can simply cancel the change to Mirror Displays, monitor settings revert, and the external monitor works as usual.

Grievance:
Unfortunately this causes windows that were on my external monitor to be misarranged across desktop workspaces (PopOS here, Ubuntu 20.10). It's a fair bit of effort to re-arrange workspaces after the mirror/cancel process.

Hopeful question:
Are there any command line utilities that might force the external monitor to reset without the need to change from Joined Display to Mirror?


Solution 1:

Two things to try:

Sometimes running xrandr with no options will cause the display to be probed and start working.

I've had problems with power saving mode to wake up one screen and not the other, especially when one was disconnected for a while. When this happens, make sure the external monitor is plugged in and powered on and then run

xset dpms force off

and wait a few seconds and then hit a key to unblank the screen. This may wake up the external monitor.

It may be necessary to cycle things completely, and a delay is needed to let things settle:

xset dpms force on; sleep 2; xset dpms force off

An automatic wait may not work, watching it manually may be more effective. If the monitor alternates between states such as blue/blank screen you may need to run the command with the monitor in one of these states (such as when it's a blank screen and not blue).