Xorg

Parses /etc/X11/xorg.conf

Authors: Raphael Pinson rap.nosp@m.hink@gmai.nosp@m.l.com Matthew Booth mbo.nosp@m.oth@redha.nosp@m.t.com

Summary
XorgParses /etc/X11/xorg.conf
ReferenceThis lens tries to keep as close as possible to `man xorg.conf` where possible.
LicenseThis file is licensed under the LGPLv2+, like the rest of Augeas.
Lens UsageSample usage of this lens in augtool
Configuration filesThis lens applies to /etc/X11/xorg.conf.
USEFUL PRIMITIVES
Generic primitives
eol
to_eolMatch everything from here to eol, cropping whitespace at both ends
indent
comment
empty
Separators
sep_spc
sep_dquote
Fields and values
entries_reThis is a list of all patterns which have specific handlers, and should therefore not be matched by the generic handler
generic_entry_re
quoted_string_val
int
ENTRIES AND OPTIONS
entry_intThis matches an entry which takes a single integer for an argument
entry_rgbThis matches an entry which takes 3 integers as arguments representing red, green and blue components
entry_xyThis matches an entry which takes 2 integers as arguments representing X and Y coordinates
entry_strThis matches an entry which takes a single quoted string
entry_genericAn entry without a specific handler.
option
screenThe Screen entry of ServerLayout
input_device
driver
identifier
videoram
default_depth
device
DISPLAY SUBSECTION
display_modes
display_entryKnown values for entries in the Display subsection
display
EXTMOD SUBSECTION
SECTIONS
section_reKnown values for Section names
secton_re_obsoleteThe following obsolete section names are still recognised for compatibility purposes.
section_entry
sectionA section in xorg.conf
lnsThe xorg.conf lens
filter

Reference

This lens tries to keep as close as possible to `man xorg.conf` where possible.

The definitions from `man xorg.conf` are put as commentaries for reference throughout the file.  More information can be found in the manual.

License

This file is licensed under the LGPLv2+, like the rest of Augeas.

Lens Usage

Sample usage of this lens in augtool

  • Get the identifier of the devices with a “Clone” option:
match "/files/etc/X11/xorg.conf/Device[Option = 'Clone']/Identifier"

Configuration files

This lens applies to /etc/X11/xorg.conf.  See filter.

USEFUL PRIMITIVES

Generic primitives

eol

let eol = Util.eol

to_eol

let to_eol = /[^ \t\n](.*[^ \t\n])?/

Match everything from here to eol, cropping whitespace at both ends

indent

let indent = Util.indent

comment

let comment = Util.comment

empty

let empty = Util.empty

Separators

sep_spc

let sep_spc = Util.del_ws_spc

sep_dquote

let sep_dquote = Util.del_str "\""

Fields and values

entries_re

let entries_re = /([oO]ption|[sS]creen|[iI]nput[dD]evice|[dD]river|[sS]ub[sS]ection|[dD]isplay|[iI]dentifier|[vV]ideo[rR]am|[dD]efault[dD]epth|[dD]evice)/

This is a list of all patterns which have specific handlers, and should therefore not be matched by the generic handler

generic_entry_re

let generic_entry_re = /[^# \t\n\/]+/ - entries_re

quoted_string_val

let quoted_string_val = del "\"" "\"" . store /[^"\n]+/ . del "\"" "\""

int

let int = /[0-9]+/

ENTRIES AND OPTIONS

entry_int

let entry_int (canon:string) (re:regexp) = [ indent . del re canon . label canon . sep_spc . store int . eol ]

This matches an entry which takes a single integer for an argument

entry_rgb

let entry_rgb (canon:string) (re:regexp) = [ indent . del re canon . label canon . [ label "red" . sep_spc . store int ] . [ label "green" . sep_spc . store int ] . [ label "blue" . sep_spc . store int ] . eol ]

This matches an entry which takes 3 integers as arguments representing red, green and blue components

entry_xy

let entry_xy (canon:string) (re:regexp) = [ indent . del re canon . label canon . [ label "x" . sep_spc . store int ] . [ label "y" . sep_spc . store int ] . eol ]

This matches an entry which takes 2 integers as arguments representing X and Y coordinates

entry_str

let entry_str (canon:string) (re:regexp) = [ indent . del re canon . label canon . sep_spc . quoted_string_val . eol ]

This matches an entry which takes a single quoted string

entry_generic

let entry_generic = [ indent . key generic_entry_re . sep_spc . store to_eol . eol ]

An entry without a specific handler.  Store everything after the keyword, cropping whitespace at both ends.

option

let option = [ indent . del /[oO]ption/ "Option" . label "Option" . sep_spc . quoted_string_val . [ label "value" . sep_spc . quoted_string_val ]* . eol ]

screen

let screen = [ indent . del /[sS]creen/ "Screen" . label "Screen" . [ sep_spc . label "num" . store int ]? . ( sep_spc . quoted_string_val . [ sep_spc . label "position" . store to_eol ]? )? . eol ]

The Screen entry of ServerLayout

input_device

let input_device = [ indent . del /[iI]nput[dD]evice/ "InputDevice" . label "InputDevice" . sep_spc . quoted_string_val . [ label "option" . sep_spc . quoted_string_val ]* . eol ]

driver

let driver = entry_str "Driver" /[dD]river/

identifier

let identifier = entry_str "Identifier" /[iI]dentifier/

videoram

let videoram = entry_int "VideoRam" /[vV]ideo[rR]am/

default_depth

let default_depth = entry_int "DefaultDepth" /[dD]efault[dD]epth/

device

let device = entry_str "Device" /[dD]evice/

DISPLAY SUBSECTION

display_modes

let display_modes = [ indent . del /[mM]odes/ "Modes" . label "Modes" . [ label "mode" . sep_spc . quoted_string_val ]+ . eol ]

display_entry

let display_entry = entry_int "Depth" /[dD]epth/ | entry_int "FbBpp" /[fF]b[bB]pp/ | entry_rgb "Weight" /[wW]eight/ | entry_xy "Virtual" /[vV]irtual/ | entry_xy "ViewPort" /[vV]iew[pP]ort/ | display_modes | entry_str "Visual" /[vV]isual/ | entry_rgb "Black" /[bB]lack/ | entry_rgb "White" /[wW]hite/ | entry_str "Options" /[oO]ptions/ | empty | comment

Known values for entries in the Display subsection

Definition

Depth    depth
FbBpp    bpp
Weight   red-weight green-weight blue-weight
Virtual  xdim ydim
ViewPort x0 y0
Modes    "mode-name" ...
Visual   "visual-name"
Black    red green blue
White    red green blue
Options

display

let display = [ indent . del "SubSection" "SubSection" . sep_spc . sep_dquote . key "Display" . sep_dquote . eol . display_entry* . indent . del "EndSubSection" "EndSubSection" . eol ]

EXTMOD SUBSECTION

SECTIONS

section_re

let section_re = /(Extensions|Files|ServerFlags|Module|InputDevice|InputClass|Device|VideoAdaptor|Monitor|Modes|Screen|ServerLayout|DRI|Vendor)/

Known values for Section names

Definition

The section names are:

Files          File pathnames
ServerFlags    Server flags
Module         Dynamic module loading
Extensions     Extension Enabling
InputDevice    Input device description
InputClass     Input Class description
Device         Graphics device description
VideoAdaptor   Xv video adaptor description
Monitor        Monitor description
Modes          Video modes descriptions
Screen         Screen configuration
ServerLayout   Overall layout
DRI            DRI-specific configuration
Vendor         Vendor-specific configuration

secton_re_obsolete

The following obsolete section names are still recognised for compatibility purposes.  In new config files, the InputDevice section should be used instead.

Definition

Keyboard       Keyboard configuration
Pointer        Pointer/mouse configuration

section_entry

let section_entry = option | screen | display | extmod | input_device | driver | identifier | videoram | default_depth | device | entry_generic | empty | comment

section

let section = [ indent . del "Section" "Section" . sep_spc . sep_dquote . key (section_re|section_re_obsolete) . sep_dquote . eol . section_entry* . indent . del "EndSection" "EndSection" . eol ]

A section in xorg.conf

Definition

Section  "SectionName"
   SectionEntry
   ...
EndSection

lns

let lns = ( empty | comment | section )*

The xorg.conf lens

filter

let eol = Util.eol
let to_eol = /[^ \t\n](.*[^ \t\n])?/
Match everything from here to eol, cropping whitespace at both ends
let indent = Util.indent
let comment = Util.comment
let empty = Util.empty
let sep_spc = Util.del_ws_spc
let sep_dquote = Util.del_str "\""
let entries_re = /([oO]ption|[sS]creen|[iI]nput[dD]evice|[dD]river|[sS]ub[sS]ection|[dD]isplay|[iI]dentifier|[vV]ideo[rR]am|[dD]efault[dD]epth|[dD]evice)/
This is a list of all patterns which have specific handlers, and should therefore not be matched by the generic handler
let generic_entry_re = /[^# \t\n\/]+/ - entries_re
let quoted_string_val = del "\"" "\"" . store /[^"\n]+/ . del "\"" "\""
let int = /[0-9]+/
let entry_int (canon:string) (re:regexp) = [ indent . del re canon . label canon . sep_spc . store int . eol ]
This matches an entry which takes a single integer for an argument
let entry_rgb (canon:string) (re:regexp) = [ indent . del re canon . label canon . [ label "red" . sep_spc . store int ] . [ label "green" . sep_spc . store int ] . [ label "blue" . sep_spc . store int ] . eol ]
This matches an entry which takes 3 integers as arguments representing red, green and blue components
let entry_xy (canon:string) (re:regexp) = [ indent . del re canon . label canon . [ label "x" . sep_spc . store int ] . [ label "y" . sep_spc . store int ] . eol ]
This matches an entry which takes 2 integers as arguments representing X and Y coordinates
let entry_str (canon:string) (re:regexp) = [ indent . del re canon . label canon . sep_spc . quoted_string_val . eol ]
This matches an entry which takes a single quoted string
let entry_generic = [ indent . key generic_entry_re . sep_spc . store to_eol . eol ]
An entry without a specific handler.
let option = [ indent . del /[oO]ption/ "Option" . label "Option" . sep_spc . quoted_string_val . [ label "value" . sep_spc . quoted_string_val ]* . eol ]
let screen = [ indent . del /[sS]creen/ "Screen" . label "Screen" . [ sep_spc . label "num" . store int ]? . ( sep_spc . quoted_string_val . [ sep_spc . label "position" . store to_eol ]? )? . eol ]
The Screen entry of ServerLayout
let input_device = [ indent . del /[iI]nput[dD]evice/ "InputDevice" . label "InputDevice" . sep_spc . quoted_string_val . [ label "option" . sep_spc . quoted_string_val ]* . eol ]
let driver = entry_str "Driver" /[dD]river/
let identifier = entry_str "Identifier" /[iI]dentifier/
let videoram = entry_int "VideoRam" /[vV]ideo[rR]am/
let default_depth = entry_int "DefaultDepth" /[dD]efault[dD]epth/
let device = entry_str "Device" /[dD]evice/
let display_modes = [ indent . del /[mM]odes/ "Modes" . label "Modes" . [ label "mode" . sep_spc . quoted_string_val ]+ . eol ]
let display_entry = entry_int "Depth" /[dD]epth/ | entry_int "FbBpp" /[fF]b[bB]pp/ | entry_rgb "Weight" /[wW]eight/ | entry_xy "Virtual" /[vV]irtual/ | entry_xy "ViewPort" /[vV]iew[pP]ort/ | display_modes | entry_str "Visual" /[vV]isual/ | entry_rgb "Black" /[bB]lack/ | entry_rgb "White" /[wW]hite/ | entry_str "Options" /[oO]ptions/ | empty | comment
Known values for entries in the Display subsection
let display = [ indent . del "SubSection" "SubSection" . sep_spc . sep_dquote . key "Display" . sep_dquote . eol . display_entry* . indent . del "EndSubSection" "EndSubSection" . eol ]
let section_re = /(Extensions|Files|ServerFlags|Module|InputDevice|InputClass|Device|VideoAdaptor|Monitor|Modes|Screen|ServerLayout|DRI|Vendor)/
Known values for Section names
let section_entry = option | screen | display | extmod | input_device | driver | identifier | videoram | default_depth | device | entry_generic | empty | comment
let section = [ indent . del "Section" "Section" . sep_spc . sep_dquote . key (section_re|section_re_obsolete) . sep_dquote . eol . section_entry* . indent . del "EndSection" "EndSection" . eol ]
A section in xorg.conf
let lns = ( empty | comment | section )*
The xorg.conf lens
Close