|
Packit Service |
a2ae7a |
(*
|
|
Packit Service |
a2ae7a |
Module: Xorg
|
|
Packit Service |
a2ae7a |
Parses /etc/X11/xorg.conf
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Authors: Raphael Pinson <raphink@gmail.com>
|
|
Packit Service |
a2ae7a |
Matthew Booth <mbooth@redhat.com>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Reference
|
|
Packit Service |
a2ae7a |
This lens tries to keep as close as possible to `man xorg.conf` where
|
|
Packit Service |
a2ae7a |
possible.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
The definitions from `man xorg.conf` are put as commentaries for reference
|
|
Packit Service |
a2ae7a |
throughout the file. More information can be found in the manual.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: License
|
|
Packit Service |
a2ae7a |
This file is licensed under the LGPLv2+, like the rest of Augeas.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Lens Usage
|
|
Packit Service |
a2ae7a |
Sample usage of this lens in augtool
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
* Get the identifier of the devices with a "Clone" option:
|
|
Packit Service |
a2ae7a |
> match "/files/etc/X11/xorg.conf/Device[Option = 'Clone']/Identifier"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Configuration files
|
|
Packit Service |
a2ae7a |
This lens applies to /etc/X11/xorg.conf. See <filter>.
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module Xorg =
|
|
Packit Service |
a2ae7a |
autoload xfm
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: USEFUL PRIMITIVES
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Group: Generic primitives *)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: eol *)
|
|
Packit Service |
a2ae7a |
let eol = Util.eol
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: to_eol
|
|
Packit Service |
a2ae7a |
* Match everything from here to eol, cropping whitespace at both ends
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
let to_eol = /[^ \t\n](.*[^ \t\n])?/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: indent *)
|
|
Packit Service |
a2ae7a |
let indent = Util.indent
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: comment *)
|
|
Packit Service |
a2ae7a |
let comment = Util.comment
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: empty *)
|
|
Packit Service |
a2ae7a |
let empty = Util.empty
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Group: Separators *)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: sep_spc *)
|
|
Packit Service |
a2ae7a |
let sep_spc = Util.del_ws_spc
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: sep_dquote *)
|
|
Packit Service |
a2ae7a |
let sep_dquote = Util.del_str "\""
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Group: Fields and values *)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: entries_re
|
|
Packit Service |
a2ae7a |
* This is a list of all patterns which have specific handlers, and should
|
|
Packit Service |
a2ae7a |
* therefore not be matched by the generic handler
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
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)/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: generic_entry_re *)
|
|
Packit Service |
a2ae7a |
let generic_entry_re = /[^# \t\n\/]+/ - entries_re
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: quoted_non_empty_string_val *)
|
|
Packit Service |
a2ae7a |
let quoted_non_empty_string_val = del "\"" "\"" . store /[^"\n]+/
|
|
Packit Service |
a2ae7a |
. del "\"" "\""
|
|
Packit Service |
a2ae7a |
(* " relax, emacs *)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: quoted_string_val *)
|
|
Packit Service |
a2ae7a |
let quoted_string_val = del "\"" "\"" . store /[^"\n]*/ . del "\"" "\""
|
|
Packit Service |
a2ae7a |
(* " relax, emacs *)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: int *)
|
|
Packit Service |
a2ae7a |
let int = /[0-9]+/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: ENTRIES AND OPTIONS
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: entry_int
|
|
Packit Service |
a2ae7a |
* This matches an entry which takes a single integer for an argument
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
let entry_int (canon:string) (re:regexp) =
|
|
Packit Service |
a2ae7a |
[ indent . del re canon . label canon . sep_spc . store int . eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: entry_rgb
|
|
Packit Service |
a2ae7a |
* This matches an entry which takes 3 integers as arguments representing red,
|
|
Packit Service |
a2ae7a |
* green and blue components
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
let entry_rgb (canon:string) (re:regexp) =
|
|
Packit Service |
a2ae7a |
[ indent . del re canon . label canon
|
|
Packit Service |
a2ae7a |
. [ label "red" . sep_spc . store int ]
|
|
Packit Service |
a2ae7a |
. [ label "green" . sep_spc . store int ]
|
|
Packit Service |
a2ae7a |
. [ label "blue" . sep_spc . store int ]
|
|
Packit Service |
a2ae7a |
. eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: entry_xy
|
|
Packit Service |
a2ae7a |
* This matches an entry which takes 2 integers as arguments representing X and
|
|
Packit Service |
a2ae7a |
* Y coordinates
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
let entry_xy (canon:string) (re:regexp) =
|
|
Packit Service |
a2ae7a |
[ indent . del re canon . label canon
|
|
Packit Service |
a2ae7a |
. [ label "x" . sep_spc . store int ]
|
|
Packit Service |
a2ae7a |
. [ label "y" . sep_spc . store int ]
|
|
Packit Service |
a2ae7a |
. eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: entry_str
|
|
Packit Service |
a2ae7a |
* This matches an entry which takes a single quoted string
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
let entry_str (canon:string) (re:regexp) =
|
|
Packit Service |
a2ae7a |
[ indent . del re canon . label canon
|
|
Packit Service |
a2ae7a |
. sep_spc . quoted_non_empty_string_val . eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: entry_generic
|
|
Packit Service |
a2ae7a |
* An entry without a specific handler. Store everything after the keyword,
|
|
Packit Service |
a2ae7a |
* cropping whitespace at both ends.
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
let entry_generic = [ indent . key generic_entry_re
|
|
Packit Service |
a2ae7a |
. sep_spc . store to_eol . eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: option *)
|
|
Packit Service |
a2ae7a |
let option = [ indent . del /[oO]ption/ "Option" . label "Option" . sep_spc
|
|
Packit Service |
a2ae7a |
. quoted_non_empty_string_val
|
|
Packit Service |
a2ae7a |
. [ label "value" . sep_spc . quoted_string_val ]*
|
|
Packit Service |
a2ae7a |
. eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: screen
|
|
Packit Service |
a2ae7a |
* The Screen entry of ServerLayout
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
let screen = [ indent . del /[sS]creen/ "Screen" . label "Screen"
|
|
Packit Service |
a2ae7a |
. [ sep_spc . label "num" . store int ]?
|
|
Packit Service |
a2ae7a |
. ( sep_spc . quoted_non_empty_string_val
|
|
Packit Service |
a2ae7a |
. [ sep_spc . label "position" . store to_eol ]? )?
|
|
Packit Service |
a2ae7a |
. eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: input_device *)
|
|
Packit Service |
a2ae7a |
let input_device = [ indent . del /[iI]nput[dD]evice/ "InputDevice"
|
|
Packit Service |
a2ae7a |
. label "InputDevice" . sep_spc
|
|
Packit Service |
a2ae7a |
. quoted_non_empty_string_val
|
|
Packit Service |
a2ae7a |
. [ label "option" . sep_spc
|
|
Packit Service |
a2ae7a |
. quoted_non_empty_string_val ]*
|
|
Packit Service |
a2ae7a |
. eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: driver *)
|
|
Packit Service |
a2ae7a |
let driver = entry_str "Driver" /[dD]river/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: identifier *)
|
|
Packit Service |
a2ae7a |
let identifier = entry_str "Identifier" /[iI]dentifier/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: videoram *)
|
|
Packit Service |
a2ae7a |
let videoram = entry_int "VideoRam" /[vV]ideo[rR]am/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: default_depth *)
|
|
Packit Service |
a2ae7a |
let default_depth = entry_int "DefaultDepth" /[dD]efault[dD]epth/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: device *)
|
|
Packit Service |
a2ae7a |
let device = entry_str "Device" /[dD]evice/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: DISPLAY SUBSECTION
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: display_modes *)
|
|
Packit Service |
a2ae7a |
let display_modes = [ indent . del /[mM]odes/ "Modes" . label "Modes"
|
|
Packit Service |
a2ae7a |
. [ label "mode" . sep_spc
|
|
Packit Service |
a2ae7a |
. quoted_non_empty_string_val ]+
|
|
Packit Service |
a2ae7a |
. eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(*************************************************************************
|
|
Packit Service |
a2ae7a |
* View: display_entry
|
|
Packit Service |
a2ae7a |
* Known values for entries in the Display subsection
|
|
Packit Service |
a2ae7a |
*
|
|
Packit Service |
a2ae7a |
* Definition:
|
|
Packit Service |
a2ae7a |
* > Depth depth
|
|
Packit Service |
a2ae7a |
* > FbBpp bpp
|
|
Packit Service |
a2ae7a |
* > Weight red-weight green-weight blue-weight
|
|
Packit Service |
a2ae7a |
* > Virtual xdim ydim
|
|
Packit Service |
a2ae7a |
* > ViewPort x0 y0
|
|
Packit Service |
a2ae7a |
* > Modes "mode-name" ...
|
|
Packit Service |
a2ae7a |
* > Visual "visual-name"
|
|
Packit Service |
a2ae7a |
* > Black red green blue
|
|
Packit Service |
a2ae7a |
* > White red green blue
|
|
Packit Service |
a2ae7a |
* > Options
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let display_entry = entry_int "Depth" /[dD]epth/ |
|
|
Packit Service |
a2ae7a |
entry_int "FbBpp" /[fF]b[bB]pp/ |
|
|
Packit Service |
a2ae7a |
entry_rgb "Weight" /[wW]eight/ |
|
|
Packit Service |
a2ae7a |
entry_xy "Virtual" /[vV]irtual/ |
|
|
Packit Service |
a2ae7a |
entry_xy "ViewPort" /[vV]iew[pP]ort/ |
|
|
Packit Service |
a2ae7a |
display_modes |
|
|
Packit Service |
a2ae7a |
entry_str "Visual" /[vV]isual/ |
|
|
Packit Service |
a2ae7a |
entry_rgb "Black" /[bB]lack/ |
|
|
Packit Service |
a2ae7a |
entry_rgb "White" /[wW]hite/ |
|
|
Packit Service |
a2ae7a |
entry_str "Options" /[oO]ptions/ |
|
|
Packit Service |
a2ae7a |
empty |
|
|
Packit Service |
a2ae7a |
comment
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: display *)
|
|
Packit Service |
a2ae7a |
let display = [ indent . del "SubSection" "SubSection" . sep_spc
|
|
Packit Service |
a2ae7a |
. sep_dquote . key "Display" . sep_dquote
|
|
Packit Service |
a2ae7a |
. eol
|
|
Packit Service |
a2ae7a |
. display_entry*
|
|
Packit Service |
a2ae7a |
. indent . del "EndSubSection" "EndSubSection" . eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: EXTMOD SUBSECTION
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let extmod_entry = entry_str "Option" /[oO]ption/ |
|
|
Packit Service |
a2ae7a |
empty |
|
|
Packit Service |
a2ae7a |
comment
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let extmod = [ indent . del "SubSection" "SubSection" . sep_spc
|
|
Packit Service |
a2ae7a |
. sep_dquote . key "extmod" . sep_dquote
|
|
Packit Service |
a2ae7a |
. eol
|
|
Packit Service |
a2ae7a |
. extmod_entry*
|
|
Packit Service |
a2ae7a |
. indent . del "EndSubSection" "EndSubSection" . eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: SECTIONS
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Variable: section_re
|
|
Packit Service |
a2ae7a |
* Known values for Section names
|
|
Packit Service |
a2ae7a |
*
|
|
Packit Service |
a2ae7a |
* Definition:
|
|
Packit Service |
a2ae7a |
* > The section names are:
|
|
Packit Service |
a2ae7a |
* >
|
|
Packit Service |
a2ae7a |
* > Files File pathnames
|
|
Packit Service |
a2ae7a |
* > ServerFlags Server flags
|
|
Packit Service |
a2ae7a |
* > Module Dynamic module loading
|
|
Packit Service |
a2ae7a |
* > Extensions Extension Enabling
|
|
Packit Service |
a2ae7a |
* > InputDevice Input device description
|
|
Packit Service |
a2ae7a |
* > InputClass Input Class description
|
|
Packit Service |
a2ae7a |
* > Device Graphics device description
|
|
Packit Service |
a2ae7a |
* > VideoAdaptor Xv video adaptor description
|
|
Packit Service |
a2ae7a |
* > Monitor Monitor description
|
|
Packit Service |
a2ae7a |
* > Modes Video modes descriptions
|
|
Packit Service |
a2ae7a |
* > Screen Screen configuration
|
|
Packit Service |
a2ae7a |
* > ServerLayout Overall layout
|
|
Packit Service |
a2ae7a |
* > DRI DRI-specific configuration
|
|
Packit Service |
a2ae7a |
* > Vendor Vendor-specific configuration
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
let section_re = /(Extensions|Files|ServerFlags|Module|InputDevice|InputClass|Device|VideoAdaptor|Monitor|Modes|Screen|ServerLayout|DRI|Vendor)/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Variable: secton_re_obsolete
|
|
Packit Service |
a2ae7a |
* The following obsolete section names are still recognised for
|
|
Packit Service |
a2ae7a |
* compatibility purposes. In new config files, the InputDevice
|
|
Packit Service |
a2ae7a |
* section should be used instead.
|
|
Packit Service |
a2ae7a |
*
|
|
Packit Service |
a2ae7a |
* Definition:
|
|
Packit Service |
a2ae7a |
* > Keyboard Keyboard configuration
|
|
Packit Service |
a2ae7a |
* > Pointer Pointer/mouse configuration
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
let section_re_obsolete = /(Keyboard|Pointer)/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: section_entry *)
|
|
Packit Service |
a2ae7a |
let section_entry = option |
|
|
Packit Service |
a2ae7a |
screen |
|
|
Packit Service |
a2ae7a |
display |
|
|
Packit Service |
a2ae7a |
extmod |
|
|
Packit Service |
a2ae7a |
input_device |
|
|
Packit Service |
a2ae7a |
driver |
|
|
Packit Service |
a2ae7a |
identifier |
|
|
Packit Service |
a2ae7a |
videoram |
|
|
Packit Service |
a2ae7a |
default_depth |
|
|
Packit Service |
a2ae7a |
device |
|
|
Packit Service |
a2ae7a |
entry_generic |
|
|
Packit Service |
a2ae7a |
empty | comment
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* View: section
|
|
Packit Service |
a2ae7a |
* A section in xorg.conf
|
|
Packit Service |
a2ae7a |
*
|
|
Packit Service |
a2ae7a |
* Definition:
|
|
Packit Service |
a2ae7a |
* > Section "SectionName"
|
|
Packit Service |
a2ae7a |
* > SectionEntry
|
|
Packit Service |
a2ae7a |
* > ...
|
|
Packit Service |
a2ae7a |
* > EndSection
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
let section = [ indent . del "Section" "Section"
|
|
Packit Service |
a2ae7a |
. sep_spc . sep_dquote
|
|
Packit Service |
a2ae7a |
. key (section_re|section_re_obsolete) . sep_dquote
|
|
Packit Service |
a2ae7a |
. eol
|
|
Packit Service |
a2ae7a |
. section_entry*
|
|
Packit Service |
a2ae7a |
. indent . del "EndSection" "EndSection" . eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(*
|
|
Packit Service |
a2ae7a |
* View: lns
|
|
Packit Service |
a2ae7a |
* The xorg.conf lens
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
let lns = ( empty | comment | section )*
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: filter *)
|
|
Packit Service |
a2ae7a |
let filter = incl "/etc/X11/xorg.conf"
|
|
Packit Service |
a2ae7a |
. incl "/etc/X11/xorg.conf.d/*.conf"
|
|
Packit Service |
a2ae7a |
. Util.stdexcl
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let xfm = transform lns filter
|