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?
To use the xdpyinfo utility command to retrieve the Linux desktop screen resolution, we will first execute the xdpyinfo command, pipe it to a grep command that will retrieve the dimensions aspect of its output, and finally pipe the values of the dimension to the awk command for display as Linux terminal output.
Find your screen resolution by running a command in Command Prompt or PowerShell (all Windows versions) If you like using the Command Prompt or PowerShell, you can use the command wmic path Win32_VideoController get CurrentHorizontalResolution,CurrentVerticalResolution to find out what resolution your screen has.
Press the Super key, then type “Display” and hit enter. The “Resolution” you pick should be the native resolution of your monitor and will generally be the recommended setting.
Check out display macros and screen macros from the Xlib manual.
Specifically:
ScreenCount()
, ScreenOfDisplay()
WidthOfScreen()
, HeightOfScreen()
This might be helpfull for cli and scripting
xwininfo -root
But xRandR might be more accurate, especially, when there is multiple monitor environment:
xrandr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With