Advertisement
Guest User

Untitled

a guest
Jun 26th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 5.10 KB | None | 0 0
  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.     raw:       any valid Openbox XML string               {raw => q(xml string)},
  12.     begin_cat: begin of a category                  {begin_cat => ["name", "icon"]},
  13.     end_cat:   end of a category                      {end_cat => undef},
  14.     obgenmenu: generic menu settings                {obgenmenu => ["label", "icon"]},
  15.     exit:      default "Exit" action                     {exit => ["label", "icon"]},
  16.  
  17. =cut
  18.  
  19. # NOTE:
  20. #    * Keys and values are case sensitive. Keep all keys lowercase.
  21. #    * ICON can be a either a direct path to an icon or a valid icon name
  22. #    * Category names are case insensitive. (X-XFCE and x_xfce are equivalent)
  23.  
  24. require "$ENV{HOME}/.config/obmenu-generator/config.pl";
  25.  
  26. ## Text editor
  27. my $editor = $CONFIG->{editor};
  28.  
  29. our $SCHEMA = [
  30.  
  31.     #          COMMAND                 LABEL                ICON
  32.     {item => ['xdg-open .',        'File Manager',      'thunar']},
  33.     {item => ['terminator',        'Terminal',          'utilities-terminal']},
  34.     {item => ['xdg-open http://',  'Web Browser',       'web-browser']},
  35.  
  36.     {sep => 'Categories'},
  37.  
  38.     #          NAME            LABEL                ICON
  39.     {cat => ['utility',     'Accessories', 'applications-utilities']},
  40.     {cat => ['development', 'Development', 'applications-development']},
  41.     {cat => ['education',   'Education',   'applications-science']},
  42.     {cat => ['game',        'Games',       'applications-games']},
  43.     {cat => ['graphics',    'Graphics',    'applications-graphics']},
  44.     {cat => ['audiovideo',  'Multimedia',  'applications-multimedia']},
  45.     {cat => ['network',     'Network',     'applications-internet']},
  46.     {cat => ['office',      'Office',      'applications-office']},
  47.     {cat => ['other',       'Other',       'applications-other']},
  48.     {cat => ['settings',    'Settings',    'applications-accessories']},
  49.     {cat => ['system',      'System',      'applications-system']},
  50.  
  51.     #{cat => ['qt',          'QT Applications',    'qt4logo']},
  52.     #{cat => ['gtk',         'GTK Applications',   'gnome-applications']},
  53.     #{cat => ['x_xfce',      'XFCE Applications',  'applications-other']},
  54.     #{cat => ['gnome',       'GNOME Applications', 'gnome-applications']},
  55.     #{cat => ['consoleonly', 'CLI Applications',   'applications-utilities']},
  56.  
  57.     #                  LABEL          ICON
  58.     #{begin_cat => ['My category',  'cat-icon']},
  59.     #             ... some items ...
  60.     #{end_cat   => undef},
  61.  
  62.     #            COMMAND     LABEL        ICON
  63.     #{pipe => ['obbrowser', 'Disk', 'drive-harddisk']},
  64.  
  65.     ## Generic advanced settings
  66.     #{sep       => undef},
  67.     #{obgenmenu => ['Openbox Settings', 'openbox']},
  68.     #{sep       => undef},
  69.  
  70.     ## Custom advanced settings
  71.     {sep => undef},
  72.     {begin_cat => ['Advanced Settings', 'gnome-settings']},
  73.  
  74.         # Configuration files
  75.         {item => ["$editor ~/.conkyrc",              'Conky RC',    'text-x-source']},
  76.         {item => ["$editor ~/.config/tint2/tint2rc", 'Tint2 Panel', 'text-x-source']},
  77.  
  78.         # obmenu-generator category
  79.         {begin_cat => ['Obmenu-Generator', 'menu-editor']},
  80.             {item => ["$editor ~/.config/obmenu-generator/schema.pl", 'Menu Schema', 'text-x-source']},
  81.             {item => ["$editor ~/.config/obmenu-generator/config.pl", 'Menu Config', 'text-x-source']},
  82.  
  83.             {sep  => undef},
  84.             {item => ["$0 -p",       'Generate a pipe menu',              'menu-editor']},
  85.             {item => ["$0 -s -c",    'Generate a static menu',            'menu-editor']},
  86.             {item => ["$0 -p -i",    'Generate a pipe menu with icons',   'menu-editor']},
  87.             {item => ["$0 -s -i -c", 'Generate a static menu with icons', 'menu-editor']},
  88.             {sep  => undef},
  89.  
  90.             {item => ['obmenu-generator -d', 'Refresh Icon Set', 'gtk-refresh']},
  91.         {end_cat => undef},
  92.  
  93.         # Openbox category
  94.         {begin_cat => ['Openbox', 'openbox']},
  95.             {item => ['openbox --reconfigure',               'Reconfigure Openbox', 'openbox']},
  96.             {item => ["$editor ~/.config/openbox/autostart", 'Openbox Autostart',   'shellscript']},
  97.             {item => ["$editor ~/.config/openbox/rc.xml",    'Openbox RC',          'text-xml']},
  98.             {item => ["$editor ~/.config/openbox/menu.xml",  'Openbox Menu',        'text-xml']},
  99.         {end_cat => undef},
  100.  
  101.     {end_cat => undef},
  102.     {sep => undef},
  103.  
  104.     ## The xscreensaver lock command
  105.     {item => ['xscreensaver-command -lock', 'Lock', 'lock']},
  106.  
  107.     # This option uses the default Openbox's action "Exit"
  108.     {exit => ['Exit', 'exit']},
  109.  
  110.     # This uses the 'oblogout' menu
  111.     # {item => ['oblogout', 'Exit', 'exit']},
  112. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement