Ubuntu 15.10装在中控机上,发现屏幕右边有黑边。 打开设置一看,分辨率不对。 1024x768的屏幕, 这里设置成了1280x1024, 并且只有一个选项。html
这时候就须要使用 xorg.conf 来配置啦!ubuntu
早期的Ubuntu ,这个文件都是放置 ··/etc/X11/xorg.conf
,可是早已废弃多年。如今须要本身建立,并放置于 /usr/share/X11/xorg.conf.d/
文件夹下面。code
xorg.conf
文件保存有X Window的各类信息,它由数个 Section/EndSecion
htm
的区块组成,格式以下:
Section "Section名称" 选项名称 "选项值" 选项名称 "选项值" …… EndSection
也就是说,一个区块以 `Section "Section` 名称"开头,以 `EndSection` 结尾,中间是选项。
monitor 设置显示器
device 设置显卡
screen 设置显示器与显卡的结合,也就是最终的显示blog
在显示设置方面,这三个区块彷佛缺一不可。
下面提供一个范例:ci
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
是本身取的名字,能够随便取。 而后在 Screen
的 section
里面,Monitor 和 Device 分别对应本身取的名字。get
新建一个 10-monitor.conf 文件,先看具体配置,而后再细细说明it
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 是很好获取的, 打开终端,运行:io
cvt 1024 768 //这里会输出 Modeline "1024x768_60.00" 63.50 1024 1072 1176 1326 768 771 775 798 -hsync +vsync
后面的两位参数,很容易懂,就是分辨率。 而后把输出结果复制粘贴进去, Modeline 下面的Option 就很好理解了, 第一个参数不变, 第二个参数就是输出的Modeline里用引号包起来的这部分。class
下面的 SubSection "Display"
直接复制粘贴,将 Modes后改成刚才设置的分辨率。
而后重启看效果吧!
部分参考文章: