问题描述
我想找一个最适合我的分辨率的壁纸。如何通过在命令行中编写命令来获得解决方案?
最佳解决思路
取自this answer:
xdpyinfo | grep dimensions
或者只获得解决方案:
xdpyinfo | awk '/dimensions/{print $2}'
要么
xdpyinfo | grep -oP 'dimensions:\s+\K\S+'
次佳解决思路
我只想使用xrandr
:
$ xrandr
Screen 0: minimum 320 x 200, current 3520 x 1200, maximum 32767 x 32767
LVDS1 connected 1600x900+1920+0 (normal left inverted right x axis y axis) 310mm x 174mm
1600x900 60.0*+
1440x900 59.9
1360x768 59.8 60.0
1152x864 60.0
1024x768 60.0
800x600 60.3 56.2
640x480 59.9
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
1920x1200 60.0*+
1920x1080 60.0 50.0 59.9 24.0 24.0
1920x1080i 60.1 50.0 60.0
1600x1200 60.0
1280x1024 75.0 60.0
1152x864 75.0
1280x720 60.0 50.0 59.9
1024x768 75.1 60.0
800x600 75.0 60.3
720x576 50.0
720x480 60.0 59.9
640x480 75.0 60.0 59.9
720x400 70.1
HDMI2 disconnected (normal left inverted right x axis y axis)
HDMI3 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
这里我有两个屏幕,分辨率是:
-
1600×900(笔记本电脑)
-
1920×1200(显示器)
要获得主监视器的分辨率,您还可以使用此python oneliner:
$ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); \
geo = screen.get_monitor_geometry(screen.get_primary_monitor()); \
print(geo.width, "x", geo.height)'
1920 x 1200
要获得extanded桌面的分辨率(用于多显示器设置):
$ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); \
print(screen.get_width(), "x", screen.get_height())'
3520 x 1200
第三种解决思路
该请求是针对该决议的。这是由
xdpyinfo | grep resolution
第四种思路
您还可以使用:
xrandr | grep ' connected'
我的一台机器上的输出示例:
LVDS connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm