mabox-pipemenus/usr/bin/jgtint2-pipe

149 lines
4.5 KiB
Plaintext
Raw Normal View History

2020-09-27 12:47:00 +02:00
#!/bin/bash
TINT2PATH="$HOME/.config/tint2"
TINT2RC="$TINT2PATH/tint2rc"
TZEN="mb-tint2-manager"
2021-05-30 12:26:18 +02:00
me="jgtint2-pipe -s"
2020-09-27 12:47:00 +02:00
case $LANG in
pl*)
TITLE="Panel Tint2"
RUNNING_TINT2="Działające Tint2"
DEFAULT_TINT2RC="Domyślny tint2rc"
2021-01-30 22:00:15 +01:00
EDIT_TINT2="Edytuj plik konfiguracyjny"
APPS="Programy (Launcher)"
2021-01-30 22:00:15 +01:00
LAUNCHERS="Dodaj/usuń programy..."
2020-09-27 12:47:00 +02:00
TINT2_EDITOR="Wybierz pliki Tint2 do edycji..."
2021-01-30 22:00:15 +01:00
TINT2_CONFIGURE="Konfiguracja"
2020-09-27 12:47:00 +02:00
CHOOSE_TINT2="Wybierz Tint2..."
RESTART_TINT2="Restartuj Tint2"
RELOAD_TINT2="Przeładuj Tint2"
2021-01-30 22:00:15 +01:00
CONFIGURE="Konfiguruj (GUI)"
REMOVE="Usuń to menu z panelu"
TRAY_HWMON="Monitor zasobów w trayu"
2020-09-27 12:47:00 +02:00
;;
es*)
TITLE="Panel Tint2"
RUNNING_TINT2="Panel(es) en ejecución"
DEFAULT_TINT2RC="Panel tint2rc x defecto"
EDIT_TINT2="Edición manual panel"
2021-01-30 22:00:15 +01:00
APPS="Launchers"
LAUNCHERS="Add/Remove Launchers..."
2020-09-27 12:47:00 +02:00
TINT2_EDITOR="Elegir panel Tint2 a editar"
2021-01-30 22:00:15 +01:00
TINT2_CONFIGURE="Editor gráfico"
2020-09-27 12:47:00 +02:00
CHOOSE_TINT2="Elegir un panel..."
RESTART_TINT2="Reiniciar panel(es)"
RELOAD_TINT2="Reload Tint2"
2021-01-30 22:00:15 +01:00
CONFIGURE="Editor gráfico"
REMOVE="Eliminar este menú del panel"
TRAY_HWMON="Systray HW monitor"
2020-09-27 12:47:00 +02:00
;;
*)
TITLE="Tint2 Panel"
RUNNING_TINT2="Running Tint2"
DEFAULT_TINT2RC="Default tint2rc"
2021-01-30 22:00:15 +01:00
EDIT_TINT2="Edit config file"
APPS="Launchers"
LAUNCHERS="Add/Remove Launchers..."
2020-09-27 12:47:00 +02:00
TINT2_EDITOR="Choose Tint2 to edit"
2021-01-30 22:00:15 +01:00
TINT2_CONFIGURE="Configure"
2020-09-27 12:47:00 +02:00
CHOOSE_TINT2="Choose Tint2..."
RESTART_TINT2="Restart Tint2"
RELOAD_TINT2="Reload Tint2"
2021-01-30 22:00:15 +01:00
CONFIGURE="Configure (GUI)"
REMOVE="Remove this menu from panel"
TRAY_HWMON="Systray HW monitor"
2020-09-27 12:47:00 +02:00
;;
esac
2021-01-30 22:00:15 +01:00
out+=("^sep($APPS)")
out+=("$LAUNCHERS,jgtint2launcher")
2020-09-27 12:47:00 +02:00
if command -v phwmon.py &>/dev/null; then
PHWRUN="mabox-obstart phwmon"
. $HOME/.config/mabox/mabox.conf
2021-05-30 12:26:18 +02:00
out+=("^sep($TRAY_HWMON)")
if [ "$(pgrep -f phwmon.py)" ];then
2021-09-08 00:49:51 +02:00
out+=("Stop/Disable,mb-setvar phwmon_monitor=false;sleep 2;$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")
2021-09-08 00:49:51 +02:00
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($TITLE)")
out+=("$CHOOSE_TINT2,$TZEN")
out+=("$RESTART_TINT2,mb-tint2restart")
out+=("$RELOAD_TINT2,killall -SIGUSR1 tint2")
#out+=("^sep($EDIT_TINT2)")
# out+=("^sep()")
fi
2021-05-30 12:26:18 +02:00
if [ $1 == "-s" ]; then
2021-09-24 01:40:09 +02:00
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
2021-05-30 12:26:18 +02:00
. $HOME/.config/mabox/mabox.conf
if [[ $panels_heightpos == "top" ]]; then
MENU_VALIGN="top"
MENU_MARGIN_Y=${panels_topmargin:-0}
elif [[ $panels_heightpos == "bottom" ]]; then
MENU_VALIGN="bottom"
MENU_MARGIN_Y=${panels_topmargin:-0}
else
MENU_VALIGN="center"
fi
2021-05-31 15:00:35 +02:00
MENU_PADDING_TOP=${jgtools_padding:-0}
2021-05-30 12:26:18 +02:00
MENU_HALIGN="left"
MENU_MARGIN_Y=40
jgmenu_icon_size=0
menu_margin_x=${submenu_spacing:-0}
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
2021-11-08 13:35:05 +01:00
POSITION_MODE=${2:-center}
2021-05-30 12:26:18 +02:00
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
2021-05-30 12:26:18 +02:00
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
2020-09-27 12:47:00 +02:00
printf '%s\n' "${out[@]}"
if [ $1 == "-r" ]; then
printf '%s\n' "^sep()"
2021-05-23 10:20:13 +02:00
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_tint2pipe=false;mb-jgtools places"
fi