xrandr 直接输这个能显示可用的分辨和当前的分辨率 xrandr -s 1920x1200就设置成指定的分辨率

利用 xrandr 命令修改屏幕分辨率

 

问题背景

  • 电脑外接着一个 23‘ 的显示器,分辨率为 1920*1080

  • 操作系统:ubuntu 14.04

今天,通过 Setting->Displays 中选择外接屏的分辨率时,发现最大只有 1024×768,并且外接屏显示 “Unknown Displays”,日了狗了。。。


解决方案

解决办法主要是给这个 “Unknown Displays” 设置一个 1920*1080 的选项,下面借助 xrandr 命令来实现。


先查看两个屏幕支持的分辨率情况

在终端输入 xrandr

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
$ xrandr Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 32767 x 32767 eDP1 connected primary 1366x768+0+312 (normal left inverted right x axis y axis) 309mm x 173mm 1366x768 60.1*+ 1360x768 59.8 60.0 1024x768 60.0 800x6060.3 56.2 640x4859.9 DP1 disconnected (normal left inverted right x axis y axis) HDMI1 disconnected (normal left inverted right x axis y axis) DP2 connected 1024x768 (normal left inverted right x axis y axis) 0mm x 0mm 1024x768 60.0* 800x6060.3 56.2 848x4860.0 640x4859.9 HDMI2 disconnected (normal left inverted right x axis y axis) VIRTUAL1 disconnected (normal left inverted right x axis y axis)

注:

  • 上面显示了两个屏幕分辨率选项,后面标示 * 即为屏幕当前分辨率
  • 这里显示好几个接口:eDP1, DP1, HDMI1, DP2, HDMI2, VIRTUAL1,但是只有 eDP1 和 DP2 有连接,并且 DP2 对应我们外接屏(这个值后面会用到!)

利用 cvt 新建一个 modeline

代码如下:

  • 1
  • 1
$ cvt 1920 1080

然后屏幕上会返回两行内容,赋值第二行中 ‘Modeline’ 后面的所有内容,并接到下面 xrandr --newmode 后面:

  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
$ xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync $ xrandr --addmode DVI1 "1920x1080_60.00"$ xrandr -s 1920x1080

其中 ”DP2“ 即上面展示的外接端口,不用的接口这个名字可能不同,比如有的会是 VGA1,以上面 xrandr 的显示结果为准。

之后,再进入 Setting->Displays, 发现那个 “Unknown Display” 的分辨率中,有了 “1920x1080” 这个选项,选中它,并 Apply 即可。

Section "InputDevice"Identifier "Generic Keyboard"Driver "kbd"Option "XkbRules" "xorg"Option "XkbModel" "pc104"Option "XkbLayout" "us"EndSectionSection "InputDevice"Identifier "Configured Mouse"Driver "mouse"EndSectionSection "Device"Identifier "Configured Video Device"EndSectionSection "Monitor"Identifier "Monitor0"VendorName "Unknown"ModelName "Unknown"HorizSync 30.0 - 83.0VertRefresh 50.0 - 75.0Option "DPMS"Modeline "1600x1200_60.00"  161.00  1600 1712 1880 2160  1200 1203 1207 1245 -hsync +vsyncModeline "1600x1228_60.00"  128.00  1600 1632 1664 1728  1200 1203 1207 1235 -hsync +vsyncModeline "1400x1050_60.00"  121.75  1400 1488 1632 1864  1050 1053 1057 1089 -hsync +vsyncModeline "1024x768_60.00"   63.50  1024 1072 1176 1328  768 771 775 798 -hsync +vsyncEndSectionSection "Screen"Identifier "Default Screen"Monitor "Monitor0"SubSection "Display"Modes "1600x1200" "1600x1228" "1400x1050" "1024x768" EndSubSectionEndSection

 
 

猜你喜欢

转载自www.cnblogs.com/xuanbjut/p/12944834.html
今日推荐