i need to get information from xrandr into my software. Suppose thats my output from xrandr -q
:
Screen 0: minimum 8 x 8, current 1920 x 1968, maximum 32767 x 32767
LVDS1 connected primary 1366x768+309+1200 (normal left inverted right x axis y axis) 277mm x 156mm
1366x768 60.02*+
1360x768 59.80 59.96
1280x720 60.00
1024x768 60.00
1024x576 60.00
960x540 60.00
800x600 60.32 56.25
864x486 60.00
640x480 59.94
720x405 60.00
680x384 60.00
640x360 60.00
DP1 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
1920x1200 59.95*+
1920x1080 60.00
1600x1200 60.00
1680x1050 59.95
1280x1024 60.02
1280x960 60.00
1024x768 60.00
800x600 60.32
640x480 60.00
720x400 70.08
The data I want is the possible solutions together with the possible refresh rates. So far my software reads the capabilities from /sys/class/drm/card0-DP-1
and so forth but I can't find any information about the possible refresh rates for any solution. Any hint on that?
I'd also like to know if and how the monitors are arranged in respect to each other, meaning when setting things up if commands like --above
, --below
, --left-of
, --right-of
have been used. Is there any way to determine that?
What I really don't want to do is to parse the xrandr output from terminal. So the question is if anyone has any idea how to do this in a nice way. I'm working in a Go environment but did not find any package which solves my problems so far.
Any help welcome.
You might want to look at the github.com/BurntSushi/xgb
package which is a pure Go implementation of XCB, and it has access to the randr
facility.