文章目录

  • Ubuntu 设置 虚拟分辨率
    • 无屏显示(开启后连接显示器会无输出,仅可使用远程控制)
      • 设置远程软件
      • 远程连接
      • 安装第三方包
      • 获取参数(跳过)
      • 设置开机生成虚拟屏幕
      • 重启以生效
    • 取消无屏显示
    • 虚拟分辨率
      • 获取目标分辨率参数
      • 添加分辨率
      • 激活分辨率
    • 尽情享用吧~

Ubuntu 设置 虚拟分辨率

无屏显示(开启后连接显示器会无输出,仅可使用远程控制)

设置远程软件

确保远程控制软件开机自动启动

远程连接

sudo apt install openssh-client

并用 ssh 远程连接

安装第三方包

根据版本安装对应的包(已测试 16.04 及 18.04)

sudo apt-get install  xserver-xorg-core-hwe-18.04
sudo apt-get install  xserver-xorg-video-dummy-hwe-18.04

获取参数(跳过)

依次为分辨率和刷新率

cvt 2560 1440 60

设置开机生成虚拟屏幕

使用上面生成的参数来设置

sudo vim /usr/share/X11/xorg.conf.d/xorg.conf

添加并修改最后的

Virtual <your-width> <your-height>

待添加内容如下

Section "Device"Identifier "dummy_videocard"Option "NoDDC" "true"Option "IgnoreEDID" "true"Driver "dummy"VideoRam 524288
EndSectionSection "Monitor"Identifier "dummy_monitor"Modeline "3840x2160_20.00" 218.15 3840 4016 4416 4992 2160 2161 2164 2185Modeline "3440x1440_20.00" 124.95 3440 3520 3864 4288 1440 1441 1444 1457Modeline "2560x1440" 42.12 2560 2592 2752 2784 1440 1475 1478 1513Modeline "1920x1440" 69.47 1920 1960 2152 2384 1440 1441 1444 1457Modeline "1920x1200" 26.28 1920 1952 2048 2080 1200 1229 1231 1261Modeline "1920x1080" 23.53 1920 1952 2040 2072 1080 1106 1108 1135HorizSync   5.0 - 1000.0VertRefresh 5.0 - 1000.0
EndSectionSection "Screen"Identifier "dummy_screen"Device "dummy_videocard"Monitor "dummy_monitor"DefaultDepth 24SubSection "Display"Depth 24Modes "3840x2160_20.00" "3440x1440_20.00" "2560x1440" "1920x1440" "1920x1200" "1920x1080"# Not sure why, but 3440x1440 won't work when the Virtual is set to "3840 2160"# However it will complain in the Xorg.log when you didn't comment out the 3840x2160 resolution at the topVirtual 2560 1440EndSubSection
EndSection

重启以生效

sudo reboot

取消无屏显示

sudo mv /usr/share/X11/xorg.conf.d/xorg.conf /usr/share/X11/xorg.conf.d/xorg.conf.bak
sudo reboot

虚拟分辨率

获取目标分辨率参数

cvt 2560 1440 75

添加分辨率

xrandr --newmode "2560x1440_75.00"  397.25  2560 2760 3040 3520  1440 1443 1448 1506 -hsync +vsync
xrandr --addmode DP-0 "2560x1440_75.00"

激活分辨率

xrandr --output DP-0 --mode "2560x1440_75.00"

尽情享用吧~