Workaround for buggy monitors: sleep causes a disconnect when using DisplayPort
I have a laptop with a Dell P2715Q external monitor connected using DisplayPort. Turns out, due to a bug in the monitor, firmware, or possibly even bad design of DisplayPort, any time the monitor goes to sleep, it acts as if it got unplugged. This is clearly unrelated to Gnome or Linux - there's plenty of complains about this behavior on Windows:
- https://www.dell.com/community/Monitors/U2414H-disconnected-when-switched-off-via-DisplayPort/m-p/5096107
- https://answers.microsoft.com/en-us/windows/forum/all/displayport-second-monitor-disconnects-when-it/88c7d4ea-f5c2-4793-bcb3-1f81f98fe5a6
- https://www.reddit.com/r/Amd/comments/5jlk82/how_to_prevent_windows_from_rearranging_when/
For the most part, Gnome handles it pretty gracefully - but it sometimes triggers bugs like #1698. Though even without that bug, the lock screen behavior is pretty jarring: when unlocking the screen, for a few seconds, lock screen is moved to the laptop screen, then back to the external monitor.
It would be nice if Gnome could ignore the DisplayPort disconnect while the monitor is asleep. I'm assuming it's possible, given that Gnome is able to wake up the external monitor while it appears to be disconnected - so there's probably some way to distinguish the "asleep" and "disconnected" cases.
I'm using Fedora 34 and Gnome 40, Wayland session.