Project

General

Profile

Feature Request #2341 » schema.pl

bill-auger, 2019-06-27 02:12 AM

 
1
#!/usr/bin/perl
2

    
3
# obmenu-generator - schema file
4

    
5
=for comment
6

    
7
    item:      add an item inside the menu               {item => ["command", "label", "icon"]},
8
    cat:       add a category inside the menu             {cat => ["name", "label", "icon"]},
9
    sep:       horizontal line separator                  {sep => undef}, {sep => "label"},
10
    pipe:      a pipe menu entry                         {pipe => ["command", "label", "icon"]},
11
    file:      include the content of an XML file        {file => "/path/to/file.xml"},
12
    raw:       any XML data supported by Openbox          {raw => q(xml data)},
13
    begin_cat: begin of a category                  {begin_cat => ["name", "icon"]},
14
    end_cat:   end of a category                      {end_cat => undef},
15
    obgenmenu: generic menu settings                {obgenmenu => ["label", "icon"]},
16
    exit:      default "Exit" action                     {exit => ["label", "icon"]},
17

    
18
=cut
19

    
20
# NOTE:
21
#    * Keys and values are case sensitive. Keep all keys lowercase.
22
#    * ICON can be a either a direct path to an icon or a valid icon name
23
#    * Category names are case insensitive. (X-XFCE and x_xfce are equivalent)
24

    
25
require "$ENV{HOME}/.config/obmenu-generator/config.pl";
26

    
27
## Text editor
28
my $editor = $CONFIG->{editor};
29

    
30
our $SCHEMA = [
31
    {sep => 'Favorites'},
32

    
33
    #          COMMAND                 LABEL                ICON
34
    {item => ['xdg-open .',        'File Manager',      'file-manager']},
35
    {item => ['xterm',             'Terminal',          'terminal']},
36
    {item => ['xdg-open http://',  'Web Browser',       'web-browser']},
37
    {item => ['gmrun',             'Run command',       'system-run']},
38

    
39
    {sep => 'Applications'},
40

    
41
    #          NAME            LABEL                ICON
42
    {cat => ['utility',     'Accessories', 'applications-utilities']},
43
    {cat => ['development', 'Development', 'applications-development']},
44
    {cat => ['education',   'Education',   'applications-science']},
45
    {cat => ['game',        'Games',       'applications-games']},
46
    {cat => ['graphics',    'Graphics',    'applications-graphics']},
47
    {cat => ['audiovideo',  'Multimedia',  'applications-multimedia']},
48
    {cat => ['network',     'Network',     'applications-internet']},
49
    {cat => ['office',      'Office',      'applications-office']},
50
    {cat => ['other',       'Other',       'applications-other']},
51

    
52
    {sep => 'Systen'},
53
    {cat => ['settings',    'Settings',    'applications-accessories']},
54
    {cat => ['system',      'System',      'applications-system']},
55

    
56
    #{cat => ['qt',          'QT Applications',    'qt4logo']},
57
    #{cat => ['gtk',         'GTK Applications',   'gnome-applications']},
58
    #{cat => ['x_xfce',      'XFCE Applications',  'applications-other']},
59
    #{cat => ['gnome',       'GNOME Applications', 'gnome-applications']},
60
    #{cat => ['consoleonly', 'CLI Applications',   'applications-utilities']},
61

    
62
    #                  LABEL          ICON
63
    #{begin_cat => ['My category',  'cat-icon']},
64
    #             ... some items ...
65
    #{end_cat   => undef},
66

    
67
    #            COMMAND     LABEL        ICON
68
    #{pipe => ['obbrowser', 'Disk', 'drive-harddisk']},
69

    
70
    ## Generic advanced settings
71
    #{sep       => undef},
72
    #{obgenmenu => ['Openbox Settings', 'openbox']},
73
    #{sep       => undef},
74

    
75
    ## Custom advanced settings
76
    #{sep => undef},
77
    #{begin_cat => ['Advanced Settings', 'gnome-settings']},
78

    
79
        # Configuration files
80
        #{item => ["$editor ~/.conkyrc",              'Conky RC',    'text-x-source']},
81
        #{item => ["$editor ~/.config/tint2/tint2rc", 'Tint2 Panel', 'text-x-source']},
82

    
83
        # obmenu-generator category
84
        #{begin_cat => ['Obmenu-Generator', 'menu-editor']},
85
            #{item => ["$editor ~/.config/obmenu-generator/schema.pl", 'Menu Schema', 'text-x-source']},
86
            #{item => ["$editor ~/.config/obmenu-generator/config.pl", 'Menu Config', 'text-x-source']},
87

    
88
            #{sep  => undef},
89
            #{item => ['obmenu-generator -p',       'Generate a pipe menu',              'menu-editor']},
90
            #{item => ['obmenu-generator -s -c',    'Generate a static menu',            'menu-editor']},
91
            #{item => ['obmenu-generator -p -i',    'Generate a pipe menu with icons',   'menu-editor']},
92
            #{item => ['obmenu-generator -s -i -c', 'Generate a static menu with icons', 'menu-editor']},
93
            #{sep  => undef},
94

    
95
            #{item => ['obmenu-generator -d', 'Refresh Icon Set', 'gtk-refresh']},
96
        #{end_cat => undef},
97

    
98
        # Openbox category
99
        #{begin_cat => ['Openbox', 'openbox']},
100
            #{item => ['openbox --reconfigure',               'Reconfigure Openbox', 'openbox']},
101
            #{item => ["$editor ~/.config/openbox/autostart", 'Openbox Autostart',   'shellscript']},
102
            #{item => ["$editor ~/.config/openbox/rc.xml",    'Openbox RC',          'text-xml']},
103
            #{item => ["$editor ~/.config/openbox/menu.xml",  'Openbox Menu',        'text-xml']},
104
        #{end_cat => undef},
105

    
106
    #{end_cat => undef},
107
    #{sep => undef},
108

    
109
    {sep => 'Session'},
110
    {item => ['openbox --reconfigure', 'Reconfigure Openbox', 'openbox']},
111

    
112
    ## The xscreensaver lock command
113
    {item => ['xscreensaver-command -lock', 'Lock', 'lock']},
114

    
115
    ## This option uses the default Openbox's action "Exit"
116
    {exit => ['Exit', 'exit']},
117

    
118
    ## This uses the 'oblogout' menu
119
    # {item => ['oblogout', 'Exit', 'exit']},
120
]
(2-2/2)