我需要从xrandr获取信息到我的软件中。假设这是我从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我想要的数据是可能的解决方案以及可能的刷新率。到目前为止,我的软件从/sys/class/drm/card0-DP-1等读取功能,但是我找不到关于任何解决方案的可能刷新率的任何信息。对此有什么提示吗?
我还想知道监视器是否以及如何彼此排列,这意味着在设置时是否使用了--above、--below、--left-of、--right-of等命令。有什么方法可以确定这一点吗?
我真正不想做的是解析来自终端的xrandr输出。所以问题是,有没有人知道如何以一种好的方式做到这一点。我在一个Go环境中工作,但到目前为止还没有找到任何可以解决我问题的包。
欢迎任何帮助。
发布于 2018-03-01 00:05:51
您可能想看看github.com/BurntSushi/xgb包,它是XCB和it has access to the randr facility的纯Go实现。
https://stackoverflow.com/questions/49033135
复制相似问题