mabox-pipemenus/usr/bin/jgtint2launcher

91 lines
2.3 KiB
Plaintext
Raw Normal View History

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"
2022-08-26 23:16:20 +02:00
out+=("@text,,$(expr $jgtools_padding + 10),$(expr $jgtools_padding + 10),340,20,4,left,top,auto,#111111,<big><b>$TITLE</b></big>")
2021-01-30 22:00:15 +01:00
out+=("@search,,34,29,292,20,4,left,top,auto,#262626,\"\"\"<big></big> <i>$TYPE_TO_SEARCH</i>\"\"\"")
out+=("^sep($CURRENT)")
2022-08-26 23:16:20 +02: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()")
2022-08-26 23:16:20 +02:00
out+=("$DEL <b>$ALL</b>: (<b>$a</b>),rm -f $LAUNCHERDIR/*.desktop;killall -SIGUSR1 tint2;jgtint2launcher")
2021-01-30 22:00:15 +01:00
fi
out+=("^sep($ADD...)")
2022-08-26 23:16:20 +02: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
2021-09-24 01:40:09 +02:00
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
2021-01-30 22:00:15 +01:00
. $HOME/.config/mabox/mabox.conf
MENU_PADDING_TOP=48
MENU_HALIGN="center"
MENU_VALIGN="center"
jgmenu_icon_size=0
2022-08-26 23:16:20 +02:00
JGWIDTH=340
2021-01-30 22:00:15 +01:00
MENU_HEIGHT_MAX=480
2021-11-08 13:35:05 +01:00
POSITION_MODE=${2:-center}
2021-01-30 22:00:15 +01:00
[ $(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