Ubuntu 15.10 使用 Xorg.conf 修改分辨率

Ubuntu 15.10装在中控机上,发现屏幕右边有黑边。 打开设置一看,分辨率不对。 1024x768的屏幕, 这里设置成了1280x1024, 而且只有一个选项。

这时候就需要使用 xorg.conf 来配置啦!

文件位置

早期的Ubuntu ,这个文件都是放置 ··/etc/X11/xorg.conf ,但是早已废弃多年。现在需要自己创建,并放置于 /usr/share/X11/xorg.conf.d/ 文件夹下面。

xorg.conf 文件简介

一、xorg.conf的一般编写规则:

xorg.conf 文件保存有X Window的各种信息,它由数个 Section/EndSecion

的区块组成,格式如下:
Section "Section名称"
    选项名称   "选项值"
    选项名称   "选项值"
    ……
EndSection
也就是说,一个区块以 `Section "Section` 名称"开头,以 `EndSection` 结尾,中间是选项。

二、显示方面的设置主要包括三个区块:

monitor 设置显示器
device 设置显卡
screen 设置显示器与显卡的结合,也就是最终的显示

在显示设置方面,这三个区块似乎缺一不可。
下面提供一个范例:

Section "Device"
    Identifier    "Whatever a Device name"
EndSection

Section "Monitor"
    Identifier    "Whatever a Monitor name"
EndSection

Section "Screen"
    Identifier    "Default Screen"
    Monitor       "Whatever a Monitor name"
    Device        "Whatever a Device name"
EndSection

在这个范例当中 , Identifier 是自己取的名字,可以随便取。 然后在 Screensection里面,Monitor 和 Device 分别对应自己取的名字。

创建配置文件

新建一个 10-monitor.conf 文件,先看具体配置,然后再细细说明

Section "Device"
    Identifier    "Whatever a Device name"
EndSection

Section "Monitor"
    Identifier    "Whatever a Monitor name"
    Modeline      "1024x768_60.00" 63.50 1024 1072 1176 1326 768 771 775 798 -hsync +vsync
    Option        "PreferredMode" "1024x768_60.00"
EndSection

Section "Screen"
    Identifier    "Default Screen"
    Monitor       "Whatever a Monitor name"
    Device        "Whatever a Device name"
    SubSection "Display"
        Modes     "1024x768"
    EndSubSection
EndSection

这里多出的就是Modeline 和下面 Subsection "Display" , 这个modeline 是很好获取的, 打开终端,运行:

cvt 1024 768

//这里会输出
Modeline      "1024x768_60.00" 63.50 1024 1072 1176 1326 768 771 775 798 -hsync +vsync

后面的两位参数,很容易懂,就是分辨率。 然后把输出结果复制粘贴进去, Modeline 下面的Option 就很好理解了, 第一个参数不变, 第二个参数就是输出的Modeline里用引号包起来的这部分。

下面的 SubSection "Display" 直接复制粘贴,将 Modes后改为刚才设置的分辨率。

然后重启看效果吧!

部分参考文章:

人在井天 - 编写xorg.conf,简单三行解决ubuntu分辩率不可调的问题

你可能感兴趣的:(ubuntu15.10,xorg.conf,分辨率)