How to query X11 display resolution?

dicroce picture dicroce · Dec 2, 2009 · Viewed 28.8k times · Source

It seems like an simple problem, but I can't find the answer: How do you query (via X11) what monitors exist and their resolutions?

Answer

asveikau picture asveikau · Dec 2, 2009

Check out display macros and screen macros from the Xlib manual.

Specifically:

  • From the first link: ScreenCount(), ScreenOfDisplay()
  • From the second link: WidthOfScreen(), HeightOfScreen()