当前位置: 首页 > 工具软件 > XRandR > 使用案例 >

i3桌面环境-xrandr添加新的分辨率模式1920x1080

汪飞捷
2023-12-01

xrandr添加新的分辨率模式1920x1080

为什么要添加分辨率模式1920x1080?

  • 虚拟机中使用xrandr查看没有1920x1080,全屏后无法覆盖整个屏幕。

基本测试环境

  • i3版本
i3 version 4.11 (2015-09-30, branch "4.11") © 2009 Michael Stapelberg and contributors
  • xrandr版本
zp@cfanzp-vm:~$ xrandr -v
xrandr program version       1.5.0
Server reports RandR version 1.5
  • ubuntu版本
zp@cfanzp-vm:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.7 LTS
Release:	16.04
Codename:	xenial

添加方法

  • 查看当前显示设置
zp@cfanzp-vm:~$ xrandr
Screen 0: minimum 1 x 1, current 1440 x 900, maximum 8192 x 8192
Virtual1 connected primary 1440x900+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   800x600       60.00 +  60.32  
   2560x1600     59.99  
   1920x1440     60.00  
   1856x1392     60.00  
   1792x1344     60.00  
   
   1920x1200     59.88  
   1600x1200     60.00  
   1680x1050     59.95  
   1400x1050     59.98  
   1280x1024     60.02  
   1440x900      59.89*  
   1280x960      60.00  
   1360x768      60.02  
   1280x800      59.81  
   1152x864      75.00  
   1280x768      59.87  
   1024x768      60.00  
   640x480       59.94  
Virtual2 disconnected (normal left inverted right x axis y axis)
Virtual3 disconnected (normal left inverted right x axis y axis)
Virtual4 disconnected (normal left inverted right x axis y axis)
Virtual5 disconnected (normal left inverted right x axis y axis)
Virtual6 disconnected (normal left inverted right x axis y axis)
Virtual7 disconnected (normal left inverted right x axis y axis)
Virtual8 disconnected (normal left inverted right x axis y axis)
  • 查看添加模式信息
zp@cfanzp-vm:~$ cvt 1920 1080
6 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
  • 添加新的模式
xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
  • 绑定虚拟显示器
xrandr --addmode Virtual1 "1920x1080_60.00"
  • 设置显示器
xrandr -s 1920x1080
  • 查看新的设置是否成功
zp@cfanzp-vm:~$ xrandr
Screen 0: minimum 1 x 1, current 1920 x 1080, maximum 8192 x 8192
Virtual1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   800x600       60.00 +  60.32  
   2560x1600     59.99  
   1920x1440     60.00  
   1856x1392     60.00  
   1792x1344     60.00  
   1920x1200     59.88  
   1600x1200     60.00  
   1680x1050     59.95  
   1400x1050     59.98  
   1280x1024     60.02  
   1440x900      59.89  
   1280x960      60.00  
   1360x768      60.02  
   1280x800      59.81  
   1152x864      75.00  
   1280x768      59.87  
   1024x768      60.00  
   640x480       59.94  
   1920x1080_60.00  59.96* 
Virtual2 disconnected (normal left inverted right x axis y axis)
Virtual3 disconnected (normal left inverted right x axis y axis)
Virtual4 disconnected (normal left inverted right x axis y axis)
Virtual5 disconnected (normal left inverted right x axis y axis)
Virtual6 disconnected (normal left inverted right x axis y axis)
Virtual7 disconnected (normal left inverted right x axis y axis)
Virtual8 disconnected (normal left inverted right x axis y axis)

  • i3配置文文件中设置分辨率
vim ~/.config/i3/config
exec --no-startup-id xrandr -s 1920x1080

参考链接

  • https://blog.csdn.net/qq_45662588/article/details/118442061

总结

  • 查看设置:xrandr
  • 查看需要设置的分辨率信息:cvt 1920 1080
  • 添加新的模式:xrandr --newmode “1920x1080_60.00” 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
  • 绑定虚拟显示器:xrandr --addmode Virtual1 “1920x1080_60.00”
  • 设置分辨率:xrandr -s 1920x1080
  • i3配置文件设置分辨率:exec --no-startup-id xrandr -s 1920x1080
 类似资料: