我在一台机器上安装了 Ubuntu 12.04,我总是从 VNC 远程使用它。当我将显示器连接到这台机器时,我可以在以下行中更改 VNC 查看器的分辨率:
$vnc4server --geometry 1440x900
Run Code Online (Sandbox Code Playgroud)
这对我有用,但我总是远程使用这台机器,我拔掉显示器并重新启动。并且上面的命令行不再起作用。
然后我尝试了xrandr
SZ: Pixels Physical Refresh
*0 1024 x 768 ( 260mm x 195mm ) *60
Current rotation - normal
Current reflection - none
Rotations possible - normal
Reflections possible - none
Run Code Online (Sandbox Code Playgroud)
只有一个选项可用,所以我尝试添加一个新选项。
$cvt 1440 900
# 1440x900 59.89 Hz (CVT 1.30MA) hsync: 55.93 kHz; pclk: 106.50 MHz
Modeline "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
$xrandr --newmode "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
$xrandr --addmode S2 "1440x900_60.00"
Run Code Online (Sandbox Code Playgroud)
然后我再次检查了xrandr并且不能看到添加的新模式。
我尝试执行以下命令并收到错误消息说我的 RandR 太旧了。
$xrandr --output S2 --mode 1440x900_60.00
xrandr: Server RandR version before 1.2
Run Code Online (Sandbox Code Playgroud)
但这对我来说没有意义,如果我重新插入显示器并运行 xrandr 命令,它会再次工作!在我可以在 VNC 查看器中更改分辨率之前,Ubuntu 似乎必须连接到真正的显示器。
任何人都可以帮忙吗?
更新: 最后我通过更改为tinyvncserver解决了这个问题
$tightvncserver -geometry 1440x900
Run Code Online (Sandbox Code Playgroud)
为我工作。
谢谢一切回答了我的问题
小智 9
当您通过 VNC 连接到无显示器 PC 时,您可以通过执行以下命令来更改分辨率:
xrandr --fb 1280x1024
Run Code Online (Sandbox Code Playgroud)
资料来源:http : //www.x.org/archive/X11R7.5/doc/man/man1/xrandr.1.html
查看 xrandr 的文档,它依赖于从显示器获取受支持分辨率的信息。在未连接显示器的情况下,xrandr 没有可用于设置显示分辨率的信息,并且很可能会从 VNC 连接的显示首选项中设置的分辨率中获取信息。无显示=屏幕分辨率没有改变。