mabox-pipemenus/usr/bin/jgtint2launcher

90 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# jgtint2launcher - Add/Remove applications to Tint2 panel launcher
#
case $LANG in
pl*)
TITLE="Dodaj/usuń programy do panelu Tint2"
TYPE_TO_SEARCH="Pisz aby Wyszukać"
CURRENT="Wyzwalacze"
OPENDIR="Otwórz"
ADD="dodaj"
DEL="usuń"
ALL="wszystkie";;
es*)
TITLE="Add/Remove Tint2 panel launchers"
TYPE_TO_SEARCH="Buscar"
CURRENT="Launchers"
OPENDIR="Abrir"
ADD="add"
DEL="remove"
ALL="all";;
*)
TITLE="Add/Remove Tint2 panel launchers"
TYPE_TO_SEARCH="Type to Search"
CURRENT="Launchers"
OPENDIR="Open"
ADD="add"
DEL="remove"
ALL="all";;
esac
: ${JGMENU_RESOURCE_OPENER=xdg-open}
LAUNCHERDIR="$HOME/.config/tint2/launcherapps"
mkdir -p ${LAUNCHERDIR}
APPSDIR="/usr/share/applications"
out+=("@text,,$(expr $jgtools_padding + 10),$(expr $jgtools_padding + 10),300,20,4,left,top,auto,#111111,<big><b>$TITLE</b></big>")
out+=("@search,,34,29,292,20,4,left,top,auto,#262626,\"\"\"<big></big> <i>$TYPE_TO_SEARCH</i>\"\"\"")
out+=("^sep($CURRENT)")
out+=("$OPENDIR <i>(~/.config/tint2/launcherapps)</i>,${JGMENU_RESOURCE_OPENER} $LAUNCHERDIR")
out+=("^sep()")
a=0
for item in "$LAUNCHERDIR"/*.desktop; do
if [[ -f $item ]]; then
((a++))
filename=${item##*/}
filename=${filename^}
out+=("$DEL <b>${filename%.*}</b>,rm $item;killall -SIGUSR1 tint2;jgtint2launcher")
fi
done
if [[ $a -gt 1 ]]; then
out+=("^sep()")
out+=("$DEL $ALL: ($a),rm -f $LAUNCHERDIR/*.desktop;killall -SIGUSR1 tint2;jgtint2launcher")
fi
out+=("^sep($ADD...)")
out+=("$OPENDIR <i>(/usr/share/applications)</i>,${JGMENU_RESOURCE_OPENER} $APPSDIR")
out+=("^sep()")
for item in "$APPSDIR"/*.desktop; do
filename=${item##*/}
filename=${filename^}
out+=("$ADD <b>${filename%.*}</b>,cp \"$item\" $LAUNCHERDIR;killall -SIGUSR1 tint2;jgtint2launcher")
done
### RUN
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
MENU_PADDING_TOP=48
MENU_HALIGN="center"
MENU_VALIGN="center"
jgmenu_icon_size=0
JGWIDTH=300
MENU_HEIGHT_MAX=480
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
printf '%s\n' "${out[@]}"
exit 0