Run an X program when a monitor is plugged in
1
vote
1
answer
779
views
I have a computer with a bizarre bug. When I turn off the monitor and turn it back on, the screen stays blank. This only happens while logged in under X (but not at the Gdm screen). I've found a way to cause the screen to turn on:
xset dpms force off
xset dpms force on
How can I run these commands automatically when the monitor is turned on?
The monitor is connected over DisplayPort and reports EDID information. The operating system is Ubuntu 18.04.
A polling-based solution is not acceptable. Turning the monitor on should react without waiting so polling would require a very short interval, but it's an infrequent action so it doesn't warrant keeping the CPU hot enough to run a task at subsecond intervals. I'm looking for a **trigger** when a monitor is plugged in, to run in the X session.
Asked by Gilles 'SO- stop being evil'
(862422 rep)
Jun 29, 2019, 09:11 PM