未插入监视器时添加假显示

我有一台没有连接外部显示器的Ubuntu 14.04服务器。 我使用NoMachine来远程控制机器。 当我这样做时,Unity / Gnome界面没有看到任何连接的监视器,因此我在使用NoMachine连接时只能使用800×600。 如果我插入显示器,我可以将分辨率设置为远程计算机上NoMachine窗口的大小。

有没有办法在Ubuntu上创建一个“假”监视器设备,所以我可以在Unity / Gnome中设置桌面分辨率?

找到了一种方法,无需虚拟插头即可完成: http : //blog.mediafederation.com/andy-hawkins/ubuntu-headless-vnc-vesa-800×600-fix/

基本上安装一个虚拟驱动程序:

sudo apt-get install xserver-xorg-video-dummy 

然后将其写入/usr/share/X11/xorg.conf.d/xorg.conf文件中(如果不存在,则创建一个):

 Section "Device" Identifier "Configured Video Device" Driver "dummy" EndSection Section "Monitor" Identifier "Configured Monitor" HorizSync 31.5-48.5 VertRefresh 50-70 EndSection Section "Screen" Identifier "Default Screen" Monitor "Configured Monitor" Device "Configured Video Device" DefaultDepth 24 SubSection "Display" Depth 24 Modes "1024x800" EndSubSection EndSection 

然后重新启动计算机。

在没有连接监视器的情况下在Ubuntu 14.04桌面上指定分辨率:

从xrandr手册页:

 --fb widthxheight Reconfigures the screen to the specified size. All configured monitors must fit within this size. When this option is not provided, xrandr computes the smallest screen size that will hold the set of configured outputs; this option provides a way to override that behaviour. 

因此在连接后使用命令:

 xrandr --fb 1280x1024 

这是一个硬件解决方案/ workarround,可用于某些图形硬件/驱动程序。

  • 您要么购买Dummy VGA(或DVI模拟)插头,要么购买Dummy Dongle。

  • 或者在VGA输出端使用3个大约75欧姆的电阻:1→6,2→7,3→8。

    +/- 10欧姆可以毫无问题地工作。 有些卡仅使用一个电阻器。 (就像我的英特尔,2→7或3→8,将被检测为监视器)

参考: 如何为您的图形卡创建虚拟插头 。

我在Ubuntu 18.04上,这是我解决它的方式:

我使用这个问题的答案创建了虚拟显示器: https : //unix.stackexchange.com/questions/378373/add-virtual-output-to-xorg

创建一个20-intel.conf文件:

sudo vi /usr/share/X11/xorg.conf.d/20-intel.conf

将以下配置信息添加到文件中:

 Section "Device" Identifier "intelgpu0" Driver "intel" Option "VirtualHeads" "2" EndSection 

这告诉Intel GPU创建2个虚拟显示器。 您可以根据需要更改VirtualHeads的数量。

然后我创建了一个shell脚本(不要忘记设置可执行文件)并将其放在启动应用程序中:

 #! /bin/bash /usr/bin/xrandr -d :0 --output VIRTUAL1 --primary --auto /usr/bin/xrandr --newmode "1600x900_60.00" 118.25 1600 1696 1856 2112 900$ /usr/bin/xrandr --addmode VIRTUAL1 "1600x900_60.00" /usr/bin/xrandr 

这样,VIRTUAL1被设置为输出并连接。 在启动时,正在创建一个新模式(使用“cvt 1600 900”找到)并指定给VIRTUAL1。

唯一的问题是:在重新启动时丢失了Dock …还没有解决。