mabox-pipemenus/usr/bin/jgtint2-pipe

113 lines
3.7 KiB
Bash
Executable File

#!/bin/bash
TINT2PATH="$HOME/.config/tint2"
TINT2RC="$TINT2PATH/tint2rc"
TZEN="mb-tint2-manager"
case $LANG in
pl*)
TITLE="Panel Tint2"
RUNNING_TINT2="Działające Tint2"
DEFAULT_TINT2RC="Domyślny tint2rc"
EDIT_TINT2="Edytuj plik konfiguracyjny"
APPS="Programy (Launcher)"
LAUNCHERS="Dodaj/usuń programy..."
TINT2_EDITOR="Wybierz pliki Tint2 do edycji..."
TINT2_CONFIGURE="Konfiguracja"
CHOOSE_TINT2="Wybierz Tint2..."
RESTART_TINT2="Restartuj Tint2"
RELOAD_TINT2="Przeładuj Tint2"
CONFIGURE="Konfiguruj (GUI)"
REMOVE="Usuń to menu z panelu"
TRAY_HWMON="Monitor zasobów w trayu"
;;
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_CONFIGURE="Editor gráfico"
CHOOSE_TINT2="Elegir un panel..."
RESTART_TINT2="Reiniciar panel(es)"
RELOAD_TINT2="Reload Tint2"
CONFIGURE="Editor gráfico"
REMOVE="Eliminar este menú del panel"
TRAY_HWMON="Systray HW monitor"
;;
*)
TITLE="Tint2 Panel"
RUNNING_TINT2="Running Tint2"
DEFAULT_TINT2RC="Default tint2rc"
EDIT_TINT2="Edit config file"
APPS="Launchers"
LAUNCHERS="Add/Remove Launchers..."
TINT2_EDITOR="Choose Tint2 to edit"
TINT2_CONFIGURE="Configure"
CHOOSE_TINT2="Choose Tint2..."
RESTART_TINT2="Restart Tint2"
RELOAD_TINT2="Reload Tint2"
CONFIGURE="Configure (GUI)"
REMOVE="Remove this menu from panel"
TRAY_HWMON="Systray HW monitor"
;;
esac
out+=("^sep($TITLE)")
out+=("$CHOOSE_TINT2,$TZEN")
out+=("$RESTART_TINT2,mb-tint2restart")
out+=("$RELOAD_TINT2,killall -SIGUSR1 tint2")
if [ "$(pidof tint2)" ];then
out+=("^sep($TINT2_CONFIGURE)")
while read -r pid cmd; do
if [[ ${cmd%% *} = tint2 ]]; then
TINT=${cmd##* }
TINT2=${TINT#$HOME/.config/tint2/}
if [[ $TINT = tint2 ]];then
TINT="$TINT2RC"
TINT2="$DEFAULT_TINT2RC"
fi
out+=("$CONFIGURE <i>$TINT2</i>,tint2conf $TINT")
out+=("$EDIT_TINT2 <i>$TINT2</i>,geany $TINT")
fi
done < <(pgrep -a tint2)
fi
#out+=("^sep($EDIT_TINT2)")
out+=("^sep($APPS)")
out+=("$LAUNCHERS,jgtint2launcher")
if command -v phwmon.py &>/dev/null; then
PHWRUN="mabox-obstart phwmon"
. $HOME/.config/mabox/mabox.conf
me="mb-jgtools ${jgtools_last}"
out+=("^sep($TRAY_HWMON)")
if [ "$(pgrep -f phwmon.py)" ];then
out+=("Stop/Disable,mb-setvar phwmon_monitor=false;$PHWRUN;$me")
else
out+=("Start/Enable,mb-setvar phwmon_monitor=true;$PHWRUN;$me")
fi
out+=("^sep()")
[[ $phwmon_cpu = false ]] && out+=("<i><s>CPU</s></i>,mb-setvar phwmon_cpu=true;$PHWRUN;$me") || out+=("CPU,mb-setvar phwmon_cpu=false;$PHWRUN;$me")
[[ $phwmon_mem = false ]] && out+=("<i><s>Memory</s></i>,mb-setvar phwmon_mem=true;$PHWRUN;$me") || out+=("Memory,mb-setvar phwmon_mem=false;$PHWRUN;$me")
[[ $phwmon_swap = false ]] && out+=("<i><s>Swap</s></i>,mb-setvar phwmon_swap=true;$PHWRUN;$me") || out+=("Swap,mb-setvar phwmon_swap=false;$PHWRUN;$me")
[[ $phwmon_net = false ]] && out+=("<i><s>Network usage</s></i>,mb-setvar phwmon_net=true;$PHWRUN;$me") || out+=("Network usage,mb-setvar phwmon_net=false;$PHWRUN;$me")
[[ $phwmon_io = false ]] && out+=("<i><s>Disk IO</s></i>,mb-setvar phwmon_io=true;$PHWRUN;$me") || out+=("Disk IO,mb-setvar phwmon_io=false;$PHWRUN;$me")
# out+=("^sep()")
fi
printf '%s\n' "${out[@]}"
if [ $1 == "-r" ]; then
printf '%s\n' "^sep()"
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_tint2pipe=false;mb-jgtools places"
fi