mabox-pipemenus/usr/bin/mb-webbrowser

110 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# mb-webbrowser
. ~/.config/mabox/mabox.conf
case $LANG in
pl*)
LABEL="Przeglądarka WWW"
SETPREF="Ustaw domyślną..."
INST="Instaluj"
;;
es*)
LABEL="Web Browser"
SETPREF="Set preferred..."
INST="Install"
;;
*)
LABEL="Web Browser"
SETPREF="Set preferred..."
INST="Install"
;;
esac
out+=("^sep($LABEL)")
if hash firefox &>/dev/null; then
out+=("Firefox,firefox,firefox")
else
out2+=("$INST Firefox,pamac-installer firefox,package-manager-icon")
fi
if hash chromium &>/dev/null; then
out+=("Chromium,chromium,chromium")
else out2+=("$INST Chromium,pamac-installer chromium,package-manager-icon")
fi
if hash vivaldi &>/dev/null; then
out+=("Vivaldi,vivaldi,vivaldi")
else out2+=("$INST Vivaldi,pamac-installer vivaldi,package-manager-icon")
fi
if hash opera &>/dev/null; then
out+=("Opera,opera,opera")
else out2+=("$INST Opera,pamac-installer opera,package-manager-icon")
fi
if hash brave &>/dev/null; then
out+=("Brave,Brave,brave")
else
out2+=("$INST Brave,pamac-installer brave,package-manager-icon")
fi
if hash qutebrowser &>/dev/null; then
out+=("Qutebrowser,qutebrowser,qutebrowser")
else out2+=("$INST Qutebrowser,pamac-installer qutebrowser,package-manager-icon")
fi
if (( ${#out[@]} > 2 )); then
out+=("^sep()")
out+=("$SETPREF,exo-preferred-applications --configure,web-browser")
fi
if (( ${#out2[@]} > 0 )); then
out+=("^sep()")
out+=("$INST ...,^checkout(inst),package-manager-icon ")
out+=("^tag(inst)")
fi
### RUN
if [[ "$1" == "-s" || "$1" == "ipc" ]]; then
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
if [[ $panels_heightpos == "top" ]]; then
MENU_VALIGN="top"
MENU_MARGIN_Y=${panels_topmargin:-0}
elif [[ $panels_heightpos == "bottom" ]]; then
MENU_VALIGN="bottom"
MENU_MARGIN_Y=${panels_topmargin:-0}
else
MENU_VALIGN="center"
fi
MENU_PADDING_TOP=${jgtools_padding:-0}
MENU_HALIGN="left"
if [[ "$1" == "ipc" ]]; then
POSITION_MODE="ipc"
else
POSITION_MODE="fixed"
fi
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
icons=1
iconmargin=4
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
printf '%s\n' "${out[@]}"
if [[ $1 == "-r" ]]; then # not used
printf '%s\n' "^sep()"
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_jgdesktops=false;mb-jgtools places"
fi
printf '%s\n' "${out2[@]}"