First, figure out what DP source your monitor runs on:
xrandr -q | grep DP
In my case it was DP-2 hence the command I needed to wake the screen was:
xrandr -d :0 --output DP-2 --auto
This is the only code you need, open terminal enter that command (change DP-2 to whatever is your source).
If you wanted to automate the whole thing, I have found only one reliable solution. It relies on swatch
to watch the /var/log/auth.log
for unlocked login keyring
message.
On Ubuntu 18.10 you install swatch
but the binary is actually called swatchdog and requires .swatchdogrc in your home dir.
In the .swatchdogrc you need:
watchfor /unlocked login keyring/
exec /path/to/the/shellscript/with/xrander/command
Launch gnome-session-properties
and add the following command:
swatchdog --tail-file /var/log/auth.log --daemon
This is a basic setup that should fix your screens. Good luck!
This solution has stopped working in Ubuntu 19.10.