未插入显示器时添加虚假显示

未插入显示器时添加虚假显示

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

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

答案1

找到了一种不需要假插头的方法:Ubuntu Headless VNC VESA 800x600 分辨率修复 ~ Andy Hawkins @ 2011 年 6 月 12 日

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

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

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

Section "Device"
    Identifier  "Configured Video Device"
    Driver      "dummy"
    # Default is 4MiB, this sets it to 16MiB
    VideoRam    16384
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

然后通过注销重新启动您的 X 会话。

答案2

指定未连接显示器的 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

答案3

考虑贰伍当您实际插入真正的显示器时,这可能是最不可能弄乱显示效果的。

以下命令将在具有 ID1和分辨率的虚拟显示器上启动 lig​​htdm1024x76

export DISPLAY=:1
Xvfb :1 -screen 0 1024x768x16 &
sleep 1

#exec gnome-session & use gnome-session instead of lightdm
exec lightdm-session &

可能相关

答案4

对我来说,上述解决方案都不起作用。要添加新设备/屏幕 VIRTUAL1,对我有用的方法是:

  • 安装数据包 xserver-xorg-video-dummy
  • 更新 xorg.conf

详细信息请参见此处:未插入显示器时添加虚假显示

信息:对我来说,它可以编辑 /etc/X11/xorg.conf 而不是 /usr/share/X11/xorg.conf.d/xorg.conf

相关内容