#!/usr/bin/env bash
#
# help-pipemenu - an Openbox pipemenu for displaying help files
#
# Archlabs 2017
#
# forked by manjaro <fhatmanjaroorg>
#

readonly HELP='
manjaro-help-pipemenu is an Openbox Pipe Menu for displaying help files
It should normally be called from an openbox menu.

Options (usually passed from the menu):
    -h --help   show this message

If manjaro-help-pipemenu is called with no options (the usual method),
it will output an xml openbox pipemenu displaying various help links,
'
for i in "$@"; do
    case "$i" in
        -h|--help) echo "$HELP" ; exit 0
    esac
done

readonly COMMON_INCLUDE="/usr/lib/manjaro/common/include.cfg"

if ! . "$COMMON_INCLUDE" 2>/dev/null; then
    echo $"Error: Failed to source $COMMON_INCLUDE" >&2 ; exit 1
fi

declareDependencies xdg-open

menuStart
menuSeparator 'MANJARO LINUX ONLINE'
menuItem 'Manjaro Homepage' 'xdg-open "https://www.manjaro.org/"'
menuItem 'Manjaro Forum' 'xdg-open "https://forum.manjaro.org/"'
menuItem 'Manjaro Wiki' 'xdg-open "https://wiki.manjaro.org/"'
menuSeparator 'GUIDES'
menuSubmenu 'OpenboxWWW' 'Openbox'
menuItem 'Openbox Homepage' 'xdg-open "http://openbox.org/"'
menuItem 'Openbox Getting Started' 'xdg-open "http://openbox.org/wiki/Help:Getting_started"'
menuItem 'Openbox Documentation' 'xdg-open "http://openbox.org/wiki/Help:Contents"'
menuItem 'Openbox FAQs' 'xdg-open "http://openbox.org/wiki/Help:FAQ"'
menuItem 'Openbox Guide Arch Wiki' 'xdg-open "http://wiki.archlinux.org/index.php/Openbox"'
menuItem 'Openbox Guide Debian Wiki' 'xdg-open "https://wiki.debian.org/Openbox"'
menuItem 'Urukramas Openbox Guide' 'xdg-open "https://urukrama.wordpress.com/openbox-faq/"'
menuItem 'Openbox Reddit' 'xdg-open "https://www.reddit.com/r/openbox/"'
menuSubmenuEnd
menuSubmenu 'Tint2WWW' 'Tint2'
menuItem 'Tint2 Wiki: FAQ' 'xdg-open "https://gitlab.com/o9000/tint2/wikis/FAQ"'
menuItem 'Tint2 Wiki: Configuration' 'xdg-open "https://gitlab.com/o9000/tint2/blob/master/doc/tint2.md"'
menuItem 'Tint2 Forum Thread' 'xdg-open "https://forums.bunsenlabs.org/viewtopic.php?id=254"'
menuSubmenuEnd
menuSubmenu 'PolybarWWW' 'Polybar'
menuItem 'Polybar GitHub' 'xdg-open "https://github.com/jaagr/polybar"'
menuItem 'Polybar Wiki' 'xdg-open "https://github.com/jaagr/polybar/wiki"'
menuItem 'Polybar Inspiration' 'xdg-open "https://www.reddit.com/r/unixporn/search?q=polybar&restrict_sr=on&sort=new&t=all"'
menuSubmenuEnd
menuSubmenu 'RofitWWW' 'Rofi'
menuItem 'Rofi GitHub' 'xdg-open "https://github.com/DaveDavenport/rofi"'
menuItem 'Rofi Wiki' 'xdg-open "https://github.com/DaveDavenport/rofi/wiki"'
menuItem 'Rofi Inspiration' 'xdg-open "https://www.reddit.com/r/unixporn/search?q=rofi&restrict_sr=on&sort=new&t=all"'
menuSubmenuEnd
menuSubmenu 'ConkyWWW' 'Conky'
menuItem 'Conky Wiki' 'xdg-open "https://github.com/brndnmtthws/conky/wiki"'
menuItem 'Conky Inspiration' 'xdg-open "https://www.reddit.com/r/unixporn/search?q=conky&restrict_sr=on&sort=new&t=all"'
menuItem 'Conky Archive' 'xdg-open "http://crunchbang.org/forums/viewtopic.php?pid=371424"'
menuItem 'Conky Reddit' 'xdg-open "https://www.reddit.com/r/conky/"'
menuSubmenuEnd
menuSubmenu 'NeofetchWWW' 'Neofetch'
menuItem 'Neofetch GitHub' 'xdg-open "https://github.com/dylanaraps/neofetch"'
menuItem 'Neofetch Wiki' 'xdg-open "https://github.com/dylanaraps/neofetch/wiki"'
menuSubmenuEnd
menuEnd
