What is the suggested way to get information on all available monitors in Linux? For example, if I have a dual monitor setup, I'd like to find out whether the second monitor extends the first one to the right, to the left, to the bottom, or to the top. Thus, I'm ultimately looking for an API that gives me something like this if the second monitor extends the first one to the right:
Monitor #1: X=0, Y=0, Width=1920, Height=1080
Monitor #2: X=1920, Y=0, Width=1920, Height=1080
Or this if the 2nd monitor extends the 1st one to the left I want to get this:
Monitor #1: X=0, Y=0, Width=1920, Height=1080
Monitor #2: X=-1920, Y=0, Width=1920, Height=1080
On Windows I can easily get this information using EnumDisplayMonitors(). But I don't see any suitable APIs on Linux. I've already checked out XF86VidMode and RandR. XF86VidMode doesn't seem to support multi-monitor setups and RandR seems to have barely any documentation. I've also scanned through the C header files of RandR and although RandR seems to be able to collect information about all available monitors, I haven't seen an API that could give me information about how the monitors are aligned to form one large screen.
Am I missing something here or is this generally not possible on Linux?
Thanks for any hints!
XineramaQueryScreens?