pipemenus for tints

master
Daniel Napora 2021-11-11 01:27:47 +01:00
parent 24b026f6c3
commit 6fe70b1985
2 changed files with 239 additions and 0 deletions

126
usr/bin/mb-places 100755
View File

@ -0,0 +1,126 @@
#!/bin/bash
# mb-places
#
. ~/.config/mabox/mabox.conf
PLACES="$HOME/.config/mabox/places.csv"
case $LANG in
pl*)
LABEL="Miejsca"
ROOTDIR="Katalog główny"
HOME_DIR="Katalog domowy"
SHOW_HIDDEN="Wyświetlanie ukrytych"
EDIT="Edytuj"
FILETOOLS="Narzędzia plikowe"
INST="Instaluj"
;;
es*)
LABEL="Places"
ROOTDIR="Root Directory (/)"
HOME_DIR="Home Directory (~)"
SHOW_HIDDEN="Show hidden files"
EDIT="Edit"
FILETOOLS="File Tools"
INST="Install"
;;
*)
LABEL="Places"
ROOTDIR="Root Directory (/)"
HOME_DIR="Home Directory (~)"
SHOW_HIDDEN="Show hidden files"
EDIT="Edit"
FILETOOLS="File Tools"
INST="Install"
;;
esac
if [ ! -f ${PLACES} ]; then
cat <<EOF > ${PLACES}
^sep($LABEL)
$ROOTDIR (<b>/</b>),^pipe(jgbrowser /),folder
^sep()
$HOME_DIR (<b>~</b>),^pipe(jgbrowser),folder-home
$(basename $(xdg-user-dir DOWNLOAD)),^pipe(jgbrowser $(xdg-user-dir DOWNLOAD)),folder-download
$(basename $(xdg-user-dir DOCUMENTS)),^pipe(jgbrowser $(xdg-user-dir DOCUMENTS)),folder-documents
$(basename $(xdg-user-dir MUSIC)),^pipe(jgbrowser $(xdg-user-dir MUSIC)),folder-music
$(basename $(xdg-user-dir PICTURES)),^pipe(jgbrowser $(xdg-user-dir PICTURES)),folder-pictures
$(basename $(xdg-user-dir VIDEOS)),^pipe(jgbrowser $(xdg-user-dir VIDEOS)),folder-video
^sep()
~/.config,^pipe(jgbrowser ~/.config),folder
EOF
fi
mapfile -t out < "$PLACES"
out+=("^sep()")
[[ $jgbrowser_show_hidden = false ]] && out+=("<i><s>$SHOW_HIDDEN</s></i>,mb-setvar jgbrowser_show_hidden=true") || out+=("$SHOW_HIDDEN,mb-setvar jgbrowser_show_hidden=false")
out+=("$EDIT $LABEL,xdg-open $PLACES,geany")
out+=("^sep($FILETOOLS)")
if hash doublecmd &>/dev/null; then
out+=("Double Commander,doublecmd,doublecmd")
else
out2+=("$INST Double Commander,pamac-installer doublecmd-gtk2,package-manager-icon")
fi
out+=("FSearch,fsearch,search")
if hash qdirstat &>/dev/null; then
out+=("QDirStat,qdirstat,qdirstat")
else
out2+=("$INST QDirStat,pamac-installer qdirstat,package-manager-icon")
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
#jgmenu_icon_size=0
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
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
printf '%s\n' "^sep()"
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_jgdesktops=false;mb-jgtools places"
fi
printf '%s\n' "${out2[@]}"

View File

@ -0,0 +1,113 @@
#!/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 brave &>/dev/null; then
out+=("Brave,Brave,brave")
else
out2+=("$INST Brave,pamac-installer brave,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 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
#jgmenu_icon_size=0
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
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
printf '%s\n' "^sep()"
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_jgdesktops=false;mb-jgtools places"
fi
printf '%s\n' "${out2[@]}"