Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / desktop.aug
1 (*
2 Module: Desktop
3    Desktop module for Augeas (.desktop files)
4
5 Author: Raphael Pinson <raphink@gmail.com>
6
7 About: Lens Usage
8    This lens is made to provide a lens for .desktop files for augeas
9
10 Reference: Freedesktop.org
11    http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
12
13 About: License
14    This file is licenced under the LGPL v2+, like the rest of Augeas.
15 *)
16
17
18 module Desktop =
19 (* We don't load this lens by default
20    Since a lot of desktop files contain unicode characters
21    which we can't parse *)
22 (*  autoload xfm *)
23
24 (* Comments can be only of # type *)
25 let comment  = IniFile.comment "#" "#"
26
27
28 (*      TITLE
29 *  These represents sections of a desktop file
30 *  Example : [DesktopEntry]
31 *)
32
33 let title = IniFile.title IniFile.record_re
34
35 let sep = IniFile.sep "=" "="
36
37 let setting = /[A-Za-z0-9_.-]+([][@A-Za-z0-9_.-]+)?/
38
39 (* Variable: sto_to_comment
40 Store until comment *)
41 let sto_to_comment = Sep.opt_space . store /[^# \t\r\n][^#\r\n]*[^# \t\r\n]|[^# \t\r\n]/
42
43 (* Entries can have comments at their end and so they are modified to represent as such *)
44 let entry = [ key setting . sep . sto_to_comment? . (comment|IniFile.eol) ] | comment
45
46 let record  = IniFile.record title entry
47
48 let lns    = IniFile.lns record comment
49
50 let filter = ( incl "/usr/share/applications/*.desktop"
51              . incl "/usr/share/applications/screensavers/*.desktop" )
52
53 let xfm = transform lns filter