xorg.conf配置详解

xorg.conf配置详解 果子小公公 2025-04-11 11:22:04 48

X11R7

X11R7其实就是目前Ubuntu使用的X Server,它于2005年12月被释出,与之前的X11R6.9其实具有相同的源代码(Source Code)。不过X11R7的模块化设计,可提高开发时的容易度。

X11R重要目录

与X11R7有关的软件,大多放在/usr及其子目录中。以下是较为重要的目录的说明:

clip_image001/usr/bin:存放X Server和不同的X Clients。

clip_image001[1]/usr/include:开发X Client和图形所需的文件路径。

clip_image001[2]/usr/lib:X Server和X Clients所需的函数库目录。

clip_image001[3]/usr/lib/X11:保存多项资源,如字体和文件等。

clip_image001[4]/usr/lib/xorg/modules:包含驱动程序与多种X Server模块。

clip_image001[5]/usr/X11/man:保存X11程序编写时的手册说明页。
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

/etc/X11/xorg.conf文件

在安装时如果没有设置X Window系统,之后必须先行设置鼠标、键盘、显示器以及显示卡等,这样才能成功启用X Window系统,而这些设置都记录在/etc/X11/xorg.conf文件中。这个文件的重要性可见一斑。

这个文件由数个Section/EndSection的区块组成,而每个区块的格式如下:

Section "Section名称"

选项名称     "选项值"

选项名称     "选项值"

选项名称     "选项值"

…

EndSection
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

下面将说明/etc/X11/xorg.conf文件中使用的Section类型及每个类型可用的选项名称和选项值。

ServerLayout

“ServerLayout”Section主要用于建立X Server启动时的外观,如果文件中包含多个ServerLayout Section,则默认会使用第一个ServerLayout Section的设置。

以下是此区块的系统默认值,以及可供使用的选项说明:

Section "ServerLayout"

        Identifier                    "Default Layout"

        Screen                        "Default Screen"

        InputDevice                "Generic Keyboard"

        InputDevice                "Configured Mouse"

        InputDevice                "stylus" "SendCoreEvents"

        InputDevice                "cursor" "SendCoreEvents"

        InputDevice                "eraser" "SendCoreEvents"

EndSection
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
<
  • Identifier:此ServerLayout Section的惟一名称。
  • “Screen”Section指定的名称,此名称左侧的数字表示在Multi-head环境下的屏幕数量,如果使用标准的Single-head显示卡,则此值为0。在此名称右侧的数字分别代表屏幕左上角的X与Y绝对坐标,默认值为“0 0”。
  • InputDevice:在X Server中的“InputDevice”Section名称。通常在此仅有两行设置,即Mouse0和Keyboard0,也就是系统中的第一个鼠标和键盘,而其他的设备大多可以忽略。

Files

“Files”Section用于设置X Server服务的路径,如字体和颜色。以下是此区块的系统默认值,以及可供使用的选项说明:

Section "Files"

        FontPath         "/usr/share/X11/fonts/misc"

        FontPath         "/usr/share/X11/fonts/cyrillic"

        FontPath         "/usr/share/X11/fonts/100dpi/:unscaled"

        FontPath         "/usr/share/X11/fonts/75dpi/:unscaled"

        FontPath         "/usr/share/X11/fonts/Type1"

        FontPath         "/usr/share/X11/fonts/100dpi"

        FontPath         "/usr/share/X11/fonts/75dpi"

        FontPath         "/usr/share/fonts/X11/misc"

        # path to defoma fonts

        FontPath         "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"

EndSection
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
<
  • RgbPath:RGB数据库的路径。这个文件定义在X中所有有效颜色的名称,并且指定数值。

  • FontPath:设置X Server寻找字体时的路径。可以同时使用多个路径,但需用逗号隔开。

Module

“Module”Section主要用来告诉X Server应加载哪些模块。这些模块可以提供额外的服务功能,一般并不需要更改此处的值。此处使用的惟一选项为“Load”,它可用来加载模块。以下是此区块的系统默认值:

Section "Module"

        Load    "i2c"

        Load    "bitmap"

        Load    "ddc"

        Load    "dri"

        Load    "extmod"

        Load    "freetype"

        Load    "glx"

        Load    "int10"

        Load    "type1"

        Load    "vbe"

EndSection
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
<

InputDevice

“InputDevice”Section用于设置鼠标或键盘等输入设备,以便通过X Server提供信息给Linux系统,多数系统至少都存在两个InputDevice Section(鼠标和键盘)。

以下是此区块的系统默认值,以及可供使用的选项说明:

Section "InputDevice"

        Identifier         "Generic Keyboard"

        Driver                        "kbd"

        Option            "CoreKeyboard"

        Option            "XkbRules"     "xorg"

        Option            "XkbModel"    "pc105"

        Option            "XkbLayout"    "us"

        Option            "XkbOptions" "lv3:ralt_switch"

EndSection

Section "InputDevice"

        Identifier         "Configured Mouse"

        Driver                        "mouse"

        Option            "CorePointer"

        Option            "Device"                    "/dev/input/mice"

        Option            "Protocol"                  "ExplorerPS/2"

        Option            "ZAxisMapping"                    "4 5"

        Option            "Emulate3Buttons"      "true"

EndSection

Section "InputDevice"

    Driver        "wacom"

    Identifier    "stylus"

    Option        "Device"        "/dev/wacom"    # Change to

                                                  # /dev/input/event

                                                 # for USB

    Option        "Type"          "stylus"

    Option        "ForceDevice"   "ISDV4"         # Tablet PC ONLY

EndSection

Section "InputDevice"

    Driver        "wacom"

    Identifier    "eraser"

    Option        "Device"        "/dev/wacom"    # Change to

                                                # /dev/input/event

                                                # for USB

    Option        "Type"          "eraser"

    Option        "ForceDevice"   "ISDV4"        # Tablet PC ONLY

EndSection

Section "InputDevice"

    Driver        "wacom"

    Identifier    "cursor"

    Option        "Device"        "/dev/wacom"    # Change to

                                                  # /dev/input/event

                                                 # for USB

    Option        "Type"          "cursor"

    Option        "ForceDevice"   "ISDV4"         # Tablet PC ONLY

EndSection
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
<
  • Identifier:设置设备的名称。通常这些名称后面都会加上一个数字,第一个设备的数字为0。例如,第一个键盘的Identifier为Keyboard0。

  • Driver:告诉X Server应该从哪里加载驱动程序。

在大多数的InputDevice Section中,尚有为数不等以“Option”为首的选项,并且包含特定的选项值。如果要启用这些选项功能,只要将每行开头的注释符号“#”去除即可。

Monitor

“Monitor”Section用于设置系统使用的显示器类型,设置此处选项时应特别留意,因为不适当的设置可能会给显示器造成损害。

以下是此区块的系统默认值,以及可供使用的选项说明:

Section "Monitor"

   Identifier    "Generic Monitor"

   Option                            "DPMS"

   HorizSync             28-51

   VertRefresh                      43-60

EndSection
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • Identifier:显示器的惟一名称。在这些名称后面都会加上一个数字,而第一个显示器的代表数字为0(Monitor0)。

  • VendorName:显示器制造商名称。

  • ModelName:显示器类型名称。

  • HorizSync:与显示器兼容的水平刷新频率范围,其单位为kHz。这个设置值会同时指出是否在此显示器中使用特定的Modeline值。

  • VertRefresh:与显示器兼容的垂直刷新频率范围,其单位为kHz。这个设置值会同时指出是否在此显示器中使用特定的Modeline值。

Device

“Device”Section用于设置显示卡的信息内容,在此文件中至少需要包含一个以上的Device Section。如果系统中包含多张显示卡,或一张显示卡上有多种设置值,则可以使用多个Device Section设置。

以下是此区块的系统默认值,以及可供使用的选项说明:

Section "Device"

        Identifier                    "VMWare Inc [VMware SVGA II] PCI Display Adapter"

        Driver                        "vmware"

        BusID                        "PCI:0:15:0"

EndSection
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • Identifier:显示卡的惟一名称。

  • Driver:用来告诉X Server应从何处加载显示卡的驱动程序。

  • VendorName:显示卡制造商名称。

  • BoardName:显示卡类型名称。

  • BusID:显示卡的总线位置,这个选项适用于多显示卡环境。

Screen

“Screen”Section合并了Device和Monitor的部分,以便能够形成成对的设置内容。在此文件中至少需要包含一个以上的Screen Section。

以下是此区块的系统默认值,以及可供使用的选项说明:

Section "Screen"

   Identifier           "Default Screen"

   Device                         "VMWare Inc [VMware SVGA II] PCI Display Adapter"

   Monitor            "Generic Monitor"

   DefaultDepth                 24

   SubSection                  "Display"

         Depth                     1

         Modes                    "1024×768" "800×600" "640×480"

   EndSubSection

   SubSection                   "Display"

         Depth                         4

         Modes             "1024×768" "800×600" "640×480"

   EndSubSection

   SubSection "                Display"

         Depth                         8

         Modes             "1024×768" "800×600" "640×480"

   EndSubSection

   SubSection                       "Display"

         Depth                         15

         Modes             "1024×768" "800×600" "640×480"

   EndSubSection

   SubSection                       "Display"

         Depth                        16

         Modes             "1024×768" "800×600" "640×480"

   EndSubSection

   SubSection                       "Display"

         Depth                         24

         Modes             "1024×768" "800×600" "640×480"

   EndSubSection

EndSection
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
<
  • Identifier:定义一个“Screen”名称,以便在“ServerLayout”Section中进行参照。

  • Device:指定“Device”Section中的名称。

  • Monitor:指定“Monitor”Section中的名称。

  • DefaultDepth:默认的色深(Color Depth)位数。

DRI

Direct Rendering Infrastructure(DRI)是一种接口,它让3D软件可以使用新型显示设备的3D硬件加速功能。除此之外,DRI也能改善2D硬件加速的性能。但通常并不使用这个选项功能,除非在“Module”Section中打开DRI设置。以下是此区块的系统默认值:

Section "DRI"

   Mode     0666

EndSection
  • 1
  • 2
  • 3
  • 4
  • 5
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包 1 收藏 评论 打赏
评论
0个
内容存在敏感词
手气红包
    易百纳技术社区暂无数据
相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
果子小公公
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区