2021-01-30 22:00:15 +01:00
|
|
|
#!/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"
|
2021-01-31 22:00:55 +01:00
|
|
|
OPENDIR="Otwórz"
|
2021-01-30 22:00:15 +01:00
|
|
|
ADD="dodaj"
|
|
|
|
DEL="usuń"
|
|
|
|
ALL="wszystkie";;
|
|
|
|
es*)
|
|
|
|
TITLE="Add/Remove Tint2 panel launchers"
|
|
|
|
TYPE_TO_SEARCH="Buscar"
|
|
|
|
CURRENT="Launchers"
|
2021-01-31 22:00:55 +01:00
|
|
|
OPENDIR="Abrir"
|
2021-01-30 22:00:15 +01:00
|
|
|
ADD="add"
|
|
|
|
DEL="remove"
|
|
|
|
ALL="all";;
|
|
|
|
*)
|
|
|
|
TITLE="Add/Remove Tint2 panel launchers"
|
|
|
|
TYPE_TO_SEARCH="Type to Search"
|
|
|
|
CURRENT="Launchers"
|
2021-01-31 22:00:55 +01:00
|
|
|
OPENDIR="Open"
|
2021-01-30 22:00:15 +01:00
|
|
|
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)")
|
2021-01-31 22:00:55 +01:00
|
|
|
out+=(" $OPENDIR <i>(~/.config/tint2/launcherapps)</i>,${JGMENU_RESOURCE_OPENER} $LAUNCHERDIR")
|
2021-01-30 22:00:15 +01:00
|
|
|
out+=("^sep()")
|
|
|
|
a=0
|
|
|
|
for item in "$LAUNCHERDIR"/*.desktop; do
|
|
|
|
if [[ -f $item ]]; then
|
|
|
|
((a++))
|
|
|
|
filename=${item##*/}
|
2021-02-01 10:58:12 +01:00
|
|
|
filename=${filename^}
|
|
|
|
out+=("$DEL <b>${filename%.*}</b>,rm $item;killall -SIGUSR1 tint2;jgtint2launcher")
|
2021-01-30 22:00:15 +01:00
|
|
|
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...)")
|
2021-01-31 22:00:55 +01:00
|
|
|
out+=(" $OPENDIR <i>(/usr/share/applications)</i>,${JGMENU_RESOURCE_OPENER} $APPSDIR")
|
2021-01-30 22:00:15 +01:00
|
|
|
out+=("^sep()")
|
|
|
|
for item in "$APPSDIR"/*.desktop; do
|
|
|
|
filename=${item##*/}
|
2021-02-01 10:58:12 +01:00
|
|
|
filename=${filename^}
|
2021-01-30 22:00:15 +01:00
|
|
|
out+=("$ADD <b>${filename%.*}</b>,cp \"$item\" $LAUNCHERDIR;killall -SIGUSR1 tint2;jgtint2launcher")
|
|
|
|
done
|
|
|
|
### RUN
|
|
|
|
|
|
|
|
. /usr/bin/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
|
|
|
|
|
|
|
|
|