diff --git a/usr/bin/jgtint2-pipe b/usr/bin/jgtint2-pipe index c0cfca5..b169039 100755 --- a/usr/bin/jgtint2-pipe +++ b/usr/bin/jgtint2-pipe @@ -10,37 +10,43 @@ case $LANG in TITLE="Panel Tint2" RUNNING_TINT2="Działające Tint2" DEFAULT_TINT2RC="Domyślny tint2rc" - EDIT_TINT2="Edytuj Tint2" + EDIT_TINT2="Edytuj plik konfiguracyjny" + APPS="Programy" + LAUNCHERS="Dodaj/usuń programy..." TINT2_EDITOR="Wybierz pliki Tint2 do edycji..." - TINT2_EDITOR_GUI="tint2conf (GUI)" + TINT2_CONFIGURE="Konfiguracja" CHOOSE_TINT2="Wybierz Tint2..." RESTART_TINT2="Restartuj Tint2" RELOAD_TINT2="Przeładuj Tint2" - CONFIGURE="Konfiguruj" + CONFIGURE="Konfiguruj (GUI)" ;; es*) TITLE="Panel Tint2" RUNNING_TINT2="Panel(es) en ejecución" DEFAULT_TINT2RC="Panel tint2rc x defecto" EDIT_TINT2="Edición manual panel" + APPS="Launchers" + LAUNCHERS="Add/Remove Launchers..." TINT2_EDITOR="Elegir panel Tint2 a editar" - TINT2_EDITOR_GUI="Editor gráfico" + TINT2_CONFIGURE="Editor gráfico" CHOOSE_TINT2="Elegir un panel..." RESTART_TINT2="Reiniciar panel(es)" RELOAD_TINT2="Reload Tint2" - CONFIGURE="Configurar" + CONFIGURE="Editor gráfico" ;; *) TITLE="Tint2 Panel" RUNNING_TINT2="Running Tint2" DEFAULT_TINT2RC="Default tint2rc" - EDIT_TINT2="Edit Tint2" + EDIT_TINT2="Edit config file" + APPS="Launchers" + LAUNCHERS="Add/Remove Launchers..." TINT2_EDITOR="Choose Tint2 to edit" - TINT2_EDITOR_GUI="tint2conf (GUI)" + TINT2_CONFIGURE="Configure" CHOOSE_TINT2="Choose Tint2..." RESTART_TINT2="Restart Tint2" RELOAD_TINT2="Reload Tint2" - CONFIGURE="Configure" + CONFIGURE="Configure (GUI)" ;; esac @@ -51,7 +57,7 @@ out+=("$RESTART_TINT2,mb-tint2restart") out+=("$RELOAD_TINT2,killall -SIGUSR1 tint2") if [ "$(pidof tint2)" ];then -out+=("^sep($TINT2_EDITOR_GUI)") +out+=("^sep($TINT2_CONFIGURE)") while read -r pid cmd; do if [[ ${cmd%% *} = tint2 ]]; then TINT=${cmd##* } @@ -67,6 +73,7 @@ out+=("^sep($TINT2_EDITOR_GUI)") done < <(pgrep -a tint2) fi #out+=("^sep($EDIT_TINT2)") - +out+=("^sep($APPS)") +out+=("$LAUNCHERS,jgtint2launcher") printf '%s\n' "${out[@]}" diff --git a/usr/bin/jgtint2launcher b/usr/bin/jgtint2launcher new file mode 100755 index 0000000..02ba08c --- /dev/null +++ b/usr/bin/jgtint2launcher @@ -0,0 +1,87 @@ +#!/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 w menadżerze plików" + ADD="dodaj" + DEL="usuń" + ALL="wszystkie";; + es*) + TITLE="Add/Remove Tint2 panel launchers" + TYPE_TO_SEARCH="Buscar" + CURRENT="Launchers" + OPENDIR="Abrir Gestor de archivos aquí" + ADD="add" + DEL="remove" + ALL="all";; + *) + TITLE="Add/Remove Tint2 panel launchers" + TYPE_TO_SEARCH="Type to Search" + CURRENT="Launchers" + OPENDIR="Open filemanager here" + 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,$TITLE") +out+=("@search,,34,29,292,20,4,left,top,auto,#262626,\"\"\" $TYPE_TO_SEARCH\"\"\"") +out+=("^sep($CURRENT)") +out+=(" $OPENDIR,${JGMENU_RESOURCE_OPENER} $LAUNCHERDIR") +out+=("^sep()") +a=0 +for item in "$LAUNCHERDIR"/*.desktop; do +if [[ -f $item ]]; then +((a++)) +filename=${item##*/} +out+=("$DEL ${filename%.*},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,${JGMENU_RESOURCE_OPENER} $APPSDIR") +out+=("^sep()") +for item in "$APPSDIR"/*.desktop; do +filename=${item##*/} +out+=("$ADD ${filename%.*},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 < ${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 + +