Search code examples
c++linuxqthdmi

Detect when HDMI cable is plugged in Desktop Linux


I need to detect when an HDMI cable has been plugged or unplugged. Getting a notification would be best, but polling would also do. I am using Qt (and Qt Creator as IDE). I don't need this to be cross platform, I can use OS-specific system calls.


Solution

  • Just from the top of my head: you can write a udev rule which sends a message via dbus to your application.