Parses /etc/X11/xorg.conf
Authors: Raphael Pinson rap@gmai l.com Matthew Booth hinkmbo@redha t.com oth
Xorg | Parses /etc/X11/xorg.conf |
Reference | This lens tries to keep as close as possible to `man xorg.conf` where possible. |
License | This file is licensed under the LGPLv2+, like the rest of Augeas. |
Lens Usage | Sample usage of this lens in augtool |
Configuration files | This lens applies to /etc/X11/xorg.conf. |
USEFUL PRIMITIVES | |
Generic primitives | |
eol | |
to_eol | Match everything from here to eol, cropping whitespace at both ends |
indent | |
comment | |
empty | |
Separators | |
sep_spc | |
sep_dquote | |
Fields and values | |
entries_re | This is a list of all patterns which have specific handlers, and should therefore not be matched by the generic handler |
generic_entry_re | |
quoted_non_empty_string_val | |
quoted_string_val | |
int | |
ENTRIES AND OPTIONS | |
entry_int | This matches an entry which takes a single integer for an argument |
entry_rgb | This matches an entry which takes 3 integers as arguments representing red, green and blue components |
entry_xy | This matches an entry which takes 2 integers as arguments representing X and Y coordinates |
entry_str | This matches an entry which takes a single quoted string |
entry_generic | An entry without a specific handler. |
option | |
screen | The Screen entry of ServerLayout |
input_device | |
driver | |
identifier | |
videoram | |
default_depth | |
device | |
DISPLAY SUBSECTION | |
display_modes | |
display_entry | Known values for entries in the Display subsection |
display | |
EXTMOD SUBSECTION | |
SECTIONS | |
section_re | Known values for Section names |
secton_re_obsolete | The following obsolete section names are still recognised for compatibility purposes. |
section_entry | |
section | A section in xorg.conf |
lns | The xorg.conf lens |
filter |
This lens applies to /etc/X11/xorg.conf. See filter.
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 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
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
let section_re = /(Extensions|Files|ServerFlags|Module|InputDevice|InputClass|Device|VideoAdaptor|Monitor|Modes|Screen|ServerLayout|DRI|Vendor)/
Known values for Section names
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
let eol = Util.eol
Match everything from here to eol, cropping whitespace at both ends
let to_eol = /[^ \t\n](.*[^ \t\n])?/
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 "\""
This is a list of all patterns which have specific handlers, and should therefore not be matched by the generic handler
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)/
let generic_entry_re = /[^# \t\n\/]+/ - entries_re
let quoted_non_empty_string_val = del "\"" "\"" . store /[^"\n]+/ . del "\"" "\""
let quoted_string_val = del "\"" "\"" . store /[^"\n]*/ . del "\"" "\""
let int = /[0-9]+/
This matches an entry which takes a single integer for an argument
let entry_int (canon:string) (re:regexp) = [ indent . del re canon . label canon . sep_spc . store int . eol ]
This matches an entry which takes 3 integers as arguments representing red, green and blue components
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 2 integers as arguments representing X and Y coordinates
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 a single quoted string
let entry_str (canon:string) (re:regexp) = [ indent . del re canon . label canon . sep_spc . quoted_non_empty_string_val . eol ]
An entry without a specific handler.
let entry_generic = [ indent . key generic_entry_re . sep_spc . store to_eol . eol ]
let option = [ indent . del /[oO]ption/ "Option" . label "Option" . sep_spc . quoted_non_empty_string_val . [ label "value" . sep_spc . quoted_string_val ]* . eol ]
The Screen entry of ServerLayout
let screen = [ indent . del /[sS]creen/ "Screen" . label "Screen" . [ sep_spc . label "num" . store int ]? . ( sep_spc . quoted_non_empty_string_val . [ sep_spc . label "position" . store to_eol ]? )? . eol ]
let input_device = [ indent . del /[iI]nput[dD]evice/ "InputDevice" . label "InputDevice" . sep_spc . quoted_non_empty_string_val . [ label "option" . sep_spc . quoted_non_empty_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_non_empty_string_val ]+ . eol ]
Known values for entries in the Display subsection
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
let display = [ indent . del "SubSection" "SubSection" . sep_spc . sep_dquote . key "Display" . sep_dquote . eol . display_entry* . indent . del "EndSubSection" "EndSubSection" . eol ]
Known values for Section names
let section_re = /(Extensions|Files|ServerFlags|Module|InputDevice|InputClass|Device|VideoAdaptor|Monitor|Modes|Screen|ServerLayout|DRI|Vendor)/
let section_entry = option | screen | display | extmod | input_device | driver | identifier | videoram | default_depth | device | entry_generic | empty | comment
A section in xorg.conf
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 ]
The xorg.conf lens
let lns = ( empty | comment | section )*