#!/usr/bin/perl

# obmenu-generator - schema file

=for comment

    item:      add an item inside the menu               {item => ["command", "label", "icon"]},
    cat:       add a category inside the menu             {cat => ["name", "label", "icon"]},
    sep:       horizontal line separator                  {sep => undef}, {sep => "label"},
    pipe:      a pipe menu entry                         {pipe => ["command", "label", "icon"]},
    raw:       any valid Openbox XML string               {raw => q(xml string)},
    beg: begin of a category                  {beg => ["name", "icon"]},
    end:   end of a category                      {end => undef},
    obgenmenu: generic menu settings                {obgenmenu => ["label", "icon"]},
    exit:      default "Exit" action                     {exit => ["label", "icon"]},

=cut

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

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

## Text editor
my $editor = $CONFIG->{editor};
my $browser = $CONFIG->{wwwbrowser};
my $terminal = $CONFIG->{terminal};
our $SCHEMA = [
	{sep => 'Mabox Menu'},
    #          COMMAND                 LABEL                ICON
    #{item => ["calamares_polkit", 'Install Mabox Linux', 'distributor-logo-mabox']},
    #{beg => ['Disk tools', 'gparted']},
	#		{item => ["gksu gparted", 'GParted', 'gparted']},
	#		{item => ["exo-open --launch TerminalEmulator sudo clonezilla", 'Clonezilla', 'drive-harddisk']},
	#		{item => ["exo-open --launch TerminalEmulator sudo testdisk", 'Testdisk', 'drive-harddisk']},
	#{end => undef},
      
    #{sep => undef},
    {item => ['exo-open --launch TerminalEmulator',        'Terminal',         'lxterminal']},
    {item => ['exo-open --launch WebBrowser',	'Web Browser', 'web-browser']},
    {item => ['exo-open --launch FileManager',           'File Manager',      'file-manager']},
    {item => ["dmenu_extended_run", 'Run...', 'go-next']},
    {sep => undef},
	
    #          NAME            LABEL                ICON
    {cat => ['utility',     'Accesories', 'applications-utilities']},
    {cat => ['development', 'Development', 'applications-development']},
    {cat => ['education',   'Education',   'applications-science']},
    {cat => ['game',        'Games',       'applications-games']},
    {cat => ['graphics',    'Graphics',    'applications-graphics']},
    {cat => ['audiovideo',  'Multimedia',  'applications-multimedia']},
    {cat => ['network',     'Network',     'applications-internet']},
    {cat => ['office',      'Office',      'applications-office']},
    {cat => ['other',       'Other',       'applications-other']},
    {cat => ['settings',    'Settings',    'applications-accessories']},
    {cat => ['system',      'System',      'applications-system']},

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

    #                  LABEL          ICON
    #{beg => ['My category',  'cat-icon']},
    #             ... some items ...
    #{end   => undef},

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

    ## Generic advanced settings
    #{sep       => undef},
    #{obgenmenu => ['Openbox Settings', 'openbox']},
    #{sep       => undef},

    ## Custom advanced settings
    
    {sep => undef},
    {beg => ['Places (S-p)', 'drive-harddisk']},
    {sep => 'Quick Navigation'},
    {pipe => ['obbrowser', 'Home Dir', 'folder_home']},
    {pipe => ['obbrowser /', '/', 'folder']},
    {sep => undef},
    {item => ["$editor ~/.config/obbrowser/config.pl", 'Configure', 'geany']},
    {item => ['rm ~/.config/obbrowser/cache.db', 'Refresh icons', 'gtk-refresh']},
    {end => undef},
    #{pipe => ["mabox-places-pipemenu", "Miejsca", "file-manager"]},
	{pipe => ["mabox-recent-files-pipemenu", "Recently used", "centrejust"]},
	{sep => undef},
	{pipe => ["mabox-software-pipemenu", "Software", "rpmdrake"]},
	{sep => undef},
	{beg => ['Screen shoots', 'emblem-camera']},
            {item => ['mb-scrot -d',        'scrot - full screen',         'emblem-camera']},
            {item => ['mb-scrot -w',        'scrot - active window',         'emblem-camera']},
            {item => ['mb-scrot -s',        'scrot - selected area',         'emblem-camera']},
	{end => undef},
	{sep => undef},
	{beg => ['Preferences', 'gnome-settings']},
	    {item => ['mbcc',        'Mabox Control Center',         'mbcc']},
	    {item => ['mbstyler',        'Mabox Styler',         '/usr/share/icons/mbs_trans_32.png']},
		{sep => 'Desktop'},
		{item => ['lxappearance',          'Look and feel',         'preferences-desktop-theme']},
		{item => ['nitrogen',          'Wallpaper',         'nitrogen']},
		{item => ['xfce4-notifyd-config',          'Notifications',         'xfce4-notifyd']},
		{pipe => ["mabox-conky-pipemenu", "Conky", "desktop-effects"]},
		{pipe => ["mabox-tint2-pipemenu", "Tint2 panel", "tint2conf"]},
		{sep => 'Settings'},
		{item => ['exo-preferred-applications',          'Preferred applications',         'preferences-desktop-default-applications']},
		{item => ['pkexec lightdm-settings', 'Login Manager', 'lightdm-settings']},
		{item => ['xfce4-power-manager-settings ', 'Power Manager', 'xfce4-power-manager-settings']},
		{sep => 'Openbox'},
		# Openbox category
        {beg => ['Openbox', 'openbox']},
            {item => ['openbox --reconfigure',               'Reconfigure Openbox', 'openbox']},
            {item => ["$editor ~/.config/openbox/autostart", 'Openbox Autostart',   'geany']},
            {item => ["$editor ~/.config/openbox/rc.xml",    'Openbox RC',          'geany']},
            {item => ["$editor ~/.config/openbox/menu.xml",  'Openbox Menu',        'geany']},
        {end => undef},
        {pipe => ["mabox-kb-pipemenu", "Keyboard shortcuts", "keyboard"]},
        # obmenu-generator category
        {beg => ['Menu', 'menu-editor']},
            {item => ["$editor ~/.config/obmenu-generator/schema.pl", 'Menu Schema', 'geany']},
            {item => ["$editor ~/.config/obmenu-generator/config.pl", 'Menu Config ', 'geany']},

            {sep  => undef},
            {item => ['obmenu-generator -p',       'Generate pipe menu',              'menu-editor']},
            {item => ['obmenu-generator -s -c',    'Generate static menu',            'menu-editor']},
            {item => ['obmenu-generator -p -i',    'Generate pipe menu with icons',   'menu-editor']},
            {item => ['obmenu-generator -s -i -c', 'Generate static menu with icons', 'menu-editor']},
            {sep  => undef},

            {item => ['obmenu-generator -d', 'Refresh iconset', 'gtk-refresh']},
        {end => undef},
        {pipe => ["mabox-compositor", "Compositor", "compton"]},
        {sep  => "Mabox Themes"},
        {item => ['mb-obthemes',          'Theme Manager',         'preferences-desktop-theme']},
       
   

    {end => undef},
     {beg => ['Help', 'help']},
		{sep => 'Online help'},
		{item => ["exo-open --launch WebBrowser https://maboxlinux.org/user-guide/", 'Mabox - user guide', 'applications-internet']},
		{item => ["exo-open --launch WebBrowser https://maboxlinux.org/forums/", 'Mabox - forum', 'applications-internet']},

		{beg => ['Manjaro', 'help']},
		{item => ["exo-open --launch WebBrowser https://manjaro.org", 'Home Site', 'applications-internet']},
		{item => ["exo-open --launch WebBrowser https://wiki.manjaro.org", 'Wiki', 'applications-internet']},
		{item => ["exo-open --launch WebBrowser https://forum.manjaro.org", 'Forum', 'applications-internet']},
		{end => undef},
		{beg => ['OpenBox', 'help']},
        {item => ["exo-open --launch WebBrowser http://openbox.org/wiki/Main_Page", 'Home Site', 'applications-internet']},
        {item => ["exo-open --launch WebBrowser http://openbox.org/wiki/Help:Contents", 'Documentation', 'applications-internet']},
        {item => ["exo-open --launch WebBrowser http://openbox.org/wiki/Help:FAQ", 'FAQ', 'applications-internet']},
        {item => ["exo-open --launch WebBrowser http://openbox.org/wiki/Help:Getting_started", 'Getting Started', 'applications-internet']},
        {end => undef},
		{beg => ['Tint2', 'help']},
		{item => ["exo-open --launch WebBrowser https://gitlab.com/o9000/tint2/wikis/FAQ", 'Tint2: FAQ', 'applications-internet']},
		{item => ["exo-open --launch WebBrowser https://gitlab.com/o9000/tint2/blob/master/doc/tint2.md", 'Tint2: Configuration', 'applications-internet']},
		{end => undef},
		{beg => ['Conky', 'help']},
		{item => ["exo-open --launch WebBrowser http://conky.sourceforge.net/config_settings.html", 'Config settings', 'applications-internet']},
		{item => ["exo-open --launch WebBrowser http://conky.sourceforge.net/variables.html", 'Variables', 'applications-internet']},
		{end => undef},
		{sep => undef},
		{beg => ['Themes', 'help']},
		{item => ["exo-open --launch WebBrowser http://www.box-look.org", 'Box-look.org', 'applications-internet']},
		{item => ["exo-open --launch WebBrowser http://www.deviantart.com/browse/all/", 'DeviantArt', 'applications-internet']},
		{end => undef},
     {end => undef},
    {sep => undef},
        
    ## The lock command
    {item => ['betterlockscreen -l', 'Lock screen', 'lock']},

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

    # This uses the 'oblogout' menu
    {item => ['rofr.sh -l', 'Exit', 'boot']},
]
