Ubuntu20.04 配置虚拟显示器和切回物理显示器

1、安装软件,用中软安装虚拟显示器软件

复制代码
sudo apt-get install xserver-xorg-core-hwe-18.04
sudo apt-get install xserver-xorg-video-dummy

2、添加配置文件

进入 /usr/share/X11/xorg.conf.d/ 文件夹下创建xorg.conf文件

复制代码
# 创建xorg.conf文件
touch xorg.conf
# 编辑xorg.conf文件
sudo nano xorg.conf

添加以下内容到xorg.conf文件中

复制代码
Section "Device"
  Identifier "Device0"
  Driver "dummy"
  VideoRam 256000
EndSection
Section "Monitor"
  Identifier "Monitor0"
  HorizSync 28.0-80.0
  VertRefresh 48.0-75.0
  Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
EndSection
Section "Screen"
  DefaultDepth 24
  Identifier "Screen0"
  Device "Device0"
  Monitor "Monitor0"
  SubSection "Display"
    Depth 24
    Modes "1920x1080_60.00"
  EndSubSection
EndSection

3、重启电脑后就可不接物理显示器也能正常远程

4、如果需要切换会使用物理显示器,需要卸载xserver-xorg-core-hwe-18.04xserver-xorg-video-dummy 包。

复制代码
sudo apt-get --purge remove xserver-xorg-core-hwe-18.04
sudo apt-get --purge remove xserver-xorg-video-dummy

5、删除xorg.conf文件

复制代码
sudo rm /usr/share/X11/xorg.conf.d/xorg.conf

6、重启电脑

相关推荐
Z***G4797 小时前
网络爬虫学习:借助DeepSeek完善爬虫软件,实现模拟鼠标右键点击,将链接另存为本地文件
爬虫·学习·计算机外设
啃火龙果的兔子2 天前
客户端频繁调用webview方法导致前端react副作用执行异常
计算机外设·交互
4***72132 天前
网络爬虫学习:借助DeepSeek完善爬虫软件,实现模拟鼠标右键点击,将链接另存为本地文件
爬虫·学习·计算机外设
S9037845973 天前
为什么取模在除数等于2^n的时候可以用按位与替代?
java·tomcat·计算机外设·hibernate
啃火龙果的兔子3 天前
webview焦点与软键盘键盘交互详解
计算机外设·交互
平凡灵感码头3 天前
经典按键扫描程序算法实现方式
单片机·矩阵·计算机外设
YUJIANYUE6 天前
Gemini一次成型龙跟随鼠标html5+canvas特效
前端·计算机外设·html5
微波炉...6 天前
Windows11,主板自带WIFI和蓝牙,蓝牙耳机、无线鼠标卡顿
计算机外设
科技每日热闻6 天前
影刃出鞘,酣战全场!EVNIA弈威双核电竞显示器27M2N6500L震撼登场!
科技·计算机外设
伍六星7 天前
电脑重启壁纸黑屏,缓一会之后鼠标在哪里划过,该部分就显示该单元壁纸
计算机外设·电脑