ubuntu设置虚拟显示器且远程连接

版本

  • ubuntu 20.04

安装虚拟显示器

sudo apt install  xserver-xorg-core-hwe-18.04
sudo apt install  xserver-xorg-video-dummy-hwe-18.04  --fix-missing

添加配置文件

在 /usr/share/X11/xorg.conf.d/ 中添加 xorg.conf 文件(系统默认就会使用虚拟显示器):

sudo vim /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 "1920x1080"
    EndSubSection
EndSection

虽然配置上面写了 “1920x1080”,但是实际上最大支持 “1360x768”,重启即可生效。

使用远程连接

使用teamviewer、todesk或者向日葵等远程工具实现远程连接即可。

重启计算机后,系统会默认使用虚拟显示器,即使接入了显示器,也不会输出信号到显示器上!

ps:如果需要再用显示器,需要删除或者重命名“xorg.conf”文件,后缀名改掉即可,如.conf_bak

猜你喜欢

转载自blog.csdn.net/weekdawn/article/details/126342081