0

I know about the libxrandr library but reading out newly attached monitor/display information, like available resolutions, requires polling.

Is there a way, in a CPP program, to get informed about changes on attached displays without asking RandR every x seconds?

ataraxis
  • 1,257
  • 1
  • 15
  • 30

1 Answers1

0

At least if you are using Gnome and Mutter you can listen to the dbus signals of Mutter.

Example of a dbus method in the same namespace:

dbus-send --session --print-reply --dest=org.gnome.Mutter.DisplayConfig /org/gnome/Mutter/DisplayConfig org.gnome.Mutter.DisplayConfig.GetCurrentState

Use a DBus viewer to find the signal you are looking for.

I don't know a solution for any other window manager

ataraxis
  • 1,257
  • 1
  • 15
  • 30