How can I detect when an external monitor is connected in linux?
I need to run various scripts to set up my workspace.
Is there some clever way to kick off a script when the monitor state has changed?
I'm using the Nvidia display driver.
|
How can I detect when an external monitor is connected in linux? I need to run various scripts to set up my workspace. Is there some clever way to kick off a script when the monitor state has changed? I'm using the Nvidia display driver.
| |||
|
feedback
|
|
I was looking for the same answer :/
| |||
|
feedback
|
|
Given that, as of 270.18, the nVidia binary drivers still don't seem to implement modern XRandR, you may just have to go with new123456's suggestion to poll a tool like On my system, I have yet to find a way to make nVidia properly announce to | |||
|
feedback
|
|
There are a set of tools called read-edid that can parse extended display identification data (EDID). If your external monitor is actually detected by these tools, you might be able to periodically check for detection and use the output to start scripts, etc. You didn't mention though whether you need to do this regardless of whether X was running. | ||||
feedback
|
xrandrevery couple seconds, and runs the script(s) if it notices a difference. – new123456 May 2 '11 at 20:01