#!/bin/bash TINT2PATH="$HOME/.config/tint2" TINT2RC="$TINT2PATH/tint2rc" TZEN="mb-tint2-manager" me="jgtint2-pipe -s" case $LANG in pl*) LNG="pl" TITLE="Panel Tint2" POSITION="Pozycja" SIZE="Rozmiar" WIDTH="Szerokość" HEIGHT="Wysokość" MARGIN="Margines" PADDING="Odstęp" COMPACT="Kompaktowy ?" AUTOHIDE="Autoukrywanie ?" SIZEHIDDEN="Rozmiar gdy ukryty" ICONS="Ikony" CLOCK_LINE1="Zegar linia 1" CLOCK_LINE2="Zegar linia 2" NONE="brak" RESET="Resetuj" TOP="Góra" BOTTOM="Dół" TOPLEFT="Góra po lewej" TOPRIGHT="Góra po prawej" LEFT="Lewa" RIGHT="Prawa" BOTTOMLEFT="Dół po lewej" BOTTOMRIGHT="Dół po prawej" HORIZONTAL="Poziomo" VERTICAL="Pionowo" SPACING="Odstęp" YES="Tak (1)" NO="Nie (0)" 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 panelu tint2" 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" START="Uruchom/Włącz" STOP="Zatrzymaj/Wyłącz" MEM="Pamięć" NET="Użycie sieci" DISC_IO="IO Dysku" ;; es*) LNG="en" TITLE="Panel Tint2" POSITION="Position" SIZE="Size" WIDTH="Width" HEIGHT="Height" MARGIN="Margin" PADDING="Padding" COMPACT="Compact?" AUTOHIDE="Autohide?" SIZEHIDDEN="Size when hidden:" ICONS="Icon theme" CLOCK_LINE1="Clock line 1" CLOCK_LINE2="Clock line 2" NONE="none" RESET="Reset to default" TOP="Top" BOTTOM="Bottom" TOPLEFT="TopLeft" TOPRIGHT="TopRight" LEFT="Left" RIGHT="Right" BOTTOMLEFT="BottomLeft" BOTTOMRIGHT="BottomRight" HORIZONTAL="Horizontal" VERTICAL="Vertical" SPACING="Spacing" YES="Yes (1)" NO="No (0)" 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" START="Start/Enable" STOP="Stop/Disable" MEM="Memory" NET="Networg usage" DISC_IO="Disc IO" ;; *) LNG="en" TITLE="Tint2 Panel" POSITION="Position" SIZE="Size" WIDTH="Width" HEIGHT="Height" MARGIN="Margin" PADDING="Padding" COMPACT="Compact?" AUTOHIDE="Autohide?" SIZEHIDDEN="Size when hidden:" ICONS="Icon theme" CLOCK_LINE1="Clock line 1" CLOCK_LINE2="Clock line 2" NONE="none" RESET="Reset to default" TOP="Top" BOTTOM="Bottom" TOPLEFT="TopLeft" TOPRIGHT="TopRight" LEFT="Left" RIGHT="Right" BOTTOMLEFT="BottomLeft" BOTTOMRIGHT="BottomRight" HORIZONTAL="Horizontal" VERTICAL="Vertical" SPACING="Spacing" YES="Yes (1)" NO="No (0)" 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 tint2 panel" 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" START="Start/Enable" STOP="Stop/Disable" MEM="Memory" NET="Networg usage" DISC_IO="Disc IO" ;; esac getvalues () { read VE HO OR <<< "$(grep panel_position ${TINT} | cut -d'=' -f2)" read W H <<< "$(grep panel_size ${TINT} | cut -d'=' -f2)" read HOR VERT <<< "$(grep panel_margin ${TINT} | cut -d'=' -f2)" read PHOR PVERT SPACE <<< "$(grep panel_padding ${TINT} | cut -d'=' -f2)" read SHRINK <<< "$(grep panel_shrink ${TINT} | cut -d'=' -f2)" read HIDE <<< "$(grep "autohide " ${TINT} | cut -d'=' -f2)" read ICONTHEME <<< "$(grep "launcher_icon_theme" ${TINT} | cut -d'=' -f2)" read PANELITEMS <<< "$(grep "panel_items" ${TINT} | cut -d'=' -f2)" read TF1 <<< "$(grep "time1_format" ${TINT} | cut -d'=' -f2)" read TF2 <<< "$(grep "time2_format" ${TINT} | cut -d'=' -f2)" } qactions () { out+=("$(printf "%-20s %20s" "$POSITION" "[ $VE $HO ]"),^checkout(ppos$i)") out+=("$(printf "%-20s %20s" "$SIZE" "[ $W ]"),^checkout(pwidth$i)") out+=("$(printf "%-20s %20s" "$WIDTH" "[ $H ]"),^checkout(pheight$i)") out+=("$(printf "%-20s %20s" "$MARGIN" "[ $HOR $VERT ]"),^checkout(pmargin$i)") out+=("$(printf "%-20s %20s" "$PADDING" "[ $PHOR $PVERT $SPACE ]"),^checkout(ppadding$i)") out+=("$(printf "%-20s %20s" "$AUTOHIDE" "[ $HIDE ]"),^checkout(phide$i)") out+=("^sep()") out+=("$ICONS [ $ICONTHEME ],^checkout(iconthemes$i)") # Clock if [[ "$PANELITEMS" == *C* ]]; then out+=("^sep()") out+=("$CLOCK_LINE1 [ $(date "+${TF1}") ],^checkout(cl1)") out+=("$CLOCK_LINE2 [ $(date "+${TF2}") ],^checkout(cl2)") out2+=("^tag(cl1)") out2+=("^sep($CLOCK_LINE1)") out2+=("$(date +"%H:%M") (%H:%M),t2ctl clockline1 '%H:%M' ${TINT};$me") out2+=("$(date +"%I:%M %p") (%I:%M %p),t2ctl clockline1 '%I:%M %p' ${TINT};$me") out2+=("$(date +"%-I:%M %p") (%I-:%M %p),t2ctl clockline1 '%-I:%M %p' ${TINT};$me") out2+=("$(date +"%H:%M:%S") (%H:%M:%S),t2ctl clockline1 '%H:%M:%S' ${TINT};$me") out2+=("^tag(cl2)") out2+=("^sep($CLOCK_LINE2)") out2+=("$NONE,t2ctl clockline2 none ${TINT};$me") out2+=("^sep()") out2+=("$(date +"%A %d %B") (%A %d %B),t2ctl clockline2 '%A %d %B' ${TINT};$me") out2+=("$(date +"%a %d %b") (%a %d %b),t2ctl clockline2 '%a %d %b' ${TINT};$me") out2+=("$(date +"%x") (%x),t2ctl clockline2 '%x' ${TINT};$me") out2+=("$(date +"%m-%d-%Y") (%m-%d-%Y),t2ctl clockline2 '%m-%d-%Y' ${TINT};$me") out2+=("$(date +"%F") (%F),t2ctl clockline2 '%F' ${TINT};$me") fi # END Clock out+=("^sep()") if [ -f "/usr/share/mabox/lang/${LNG}/.config/tint2/${TINT2}" ];then out+=("$RESET,t2ctl reset ${TINT2};me") out+=("^sep()") fi out2+=("^tag(iconthemes$i)") for item in "/usr/share/icons"/*; do if [[ -d $item ]]; then out2+=("${item##*/},t2ctl icontheme ${item##*/} ${TINT};$me") fi done out2+=("^tag(ppos$i)") out2+=("^sep($POSITION)") out2+=("^sep($HORIZONTAL)") out2+=(" $TOP,t2ctl position tch ${TINT};$me") out2+=(" $BOTTOM,t2ctl position bch ${TINT};$me") out2+=("^sep()") out2+=(" $TOPLEFT,t2ctl position tlh ${TINT};$me") out2+=(" $TOPRIGHT,t2ctl position trh ${TINT};$me") out2+=(" $BOTTOMLEFT,t2ctl position blh ${TINT};$me") out2+=(" $BOTTOMRIGHT,t2ctl position brh ${TINT};$me") out2+=("^sep($VERTICAL)") out2+=(" $LEFT,t2ctl position clv ${TINT};$me") out2+=(" $RIGHT,t2ctl position crv ${TINT};$me") out2+=("^sep()") out2+=(" $TOPLEFT,t2ctl position tlv ${TINT};$me") out2+=(" $TOPRIGHT,t2ctl position trv ${TINT};$me") out2+=(" $BOTTOMLEFT,t2ctl position blv ${TINT};$me") out2+=(" $BOTTOMRIGHT,t2ctl position brv ${TINT};$me") out2+=("^tag(pwidth$i)") out2+=("^sep($SIZE)") out2+=("100%,t2ctl width 100% ${TINT};$me") out2+=("95%,t2ctl width 95% ${TINT};$me") out2+=("90%,t2ctl width 90% ${TINT};$me") out2+=("80%,t2ctl width 80% ${TINT};$me") out2+=("75%,t2ctl width 75% ${TINT};$me") out2+=("60%,t2ctl width 60% ${TINT};$me") out2+=("50%,t2ctl width 50% ${TINT};$me") out2+=("40%,t2ctl width 40% ${TINT};$me") out2+=("30%,t2ctl width 30% ${TINT};$me") out2+=("^sep()") out2+=("$(printf "%-20s %20s" "$COMPACT" "[ $SHRINK ]"),^checkout(pcompact$i)") out2+=("") out2+=("^tag(pheight$i)") out2+=("^sep($WIDTH)") out2+=("24,t2ctl height 24 ${TINT};$me") out2+=("28,t2ctl height 28 ${TINT};$me") out2+=("32,t2ctl height 32 ${TINT};$me") out2+=("40,t2ctl height 40 ${TINT};$me") out2+=("48,t2ctl height 48 ${TINT};$me") out2+=("60,t2ctl height 60 ${TINT};$me") out2+=("^tag(pmargin$i)") out2+=("^sep($HORIZONTAL)") out2+=("0,t2ctl marginh 0 ${TINT};$me") out2+=("1,t2ctl marginh 1 ${TINT};$me") out2+=("2,t2ctl marginh 2 ${TINT};$me") out2+=("4,t2ctl marginh 4 ${TINT};$me") out2+=("") out2+=("^sep($VERTICAL)") out2+=("0,t2ctl marginv 0 ${TINT};$me") out2+=("1,t2ctl marginv 1 ${TINT};$me") out2+=("2,t2ctl marginv 2 ${TINT};$me") out2+=("4,t2ctl marginv 4 ${TINT};$me") out2+=("^tag(ppadding$i)") out2+=("^sep($HORIZONTAL)") out2+=("0,t2ctl paddingh 0 ${TINT};$me") out2+=("1,t2ctl paddingh 1 ${TINT};$me") out2+=("2,t2ctl paddingh 2 ${TINT};$me") out2+=("4,t2ctl paddingh 4 ${TINT};$me") out2+=("") out2+=("^sep($VERTICAL)") out2+=("0,t2ctl paddingv 0 ${TINT};$me") out2+=("1,t2ctl paddingv 1 ${TINT};$me") out2+=("2,t2ctl paddingv 2 ${TINT};$me") out2+=("4,t2ctl paddingv 4 ${TINT};$me") out2+=("^sep($SPACING)") out2+=("0,t2ctl spacing 0 ${TINT};$me") out2+=("1,t2ctl spacing 1 ${TINT};$me") out2+=("2,t2ctl spacing 2 ${TINT};$me") out2+=("4,t2ctl spacing 4 ${TINT};$me") out2+=("^tag(pcompact$i)") out2+=("^sep($COMPACT)") out2+=("$NO,t2ctl shrink 0 ${TINT};$me") out2+=("$YES,t2ctl shrink 1 ${TINT};$me") out2+=("^tag(phide$i)") out2+=("^sep($AUTOHIDE)") out2+=("$NO,t2ctl autohide 0 ${TINT};$me") out2+=("$YES,t2ctl autohide 1 ${TINT}") out2+=("^sep($SIZEHIDDEN)") out2+=("1,t2ctl hideheight 1 ${TINT}") out2+=("2,t2ctl hideheight 2 ${TINT}") out2+=("3,t2ctl hideheight 3 ${TINT}") out2+=("4,t2ctl hideheight 4 ${TINT}") out2+=("5,t2ctl hideheight 5 ${TINT}") } out+=("^sep($TITLE)") out+=("^sep($APPS)") out+=("$LAUNCHERS,jgtint2launcher") if [ "$(pidof tint2)" ];then i=0 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+=("^sep($TINT2)") ((i=i+1)) getvalues qactions out+=("$CONFIGURE $TINT2,tint2conf $TINT") out+=("$EDIT_TINT2 $TINT2,xdg-open $TINT") fi done < <(pgrep -a tint2) fi if command -v phwmon.py &>/dev/null; then PHWRUN="mabox-obstart phwmon" . $HOME/.config/mabox/mabox.conf out+=("^sep($TRAY_HWMON)") if [ "$(pgrep -f phwmon.py)" ];then out+=("$STOP,mb-setvar phwmon_monitor=false;sleep 2;$PHWRUN;$me") else out+=("$START,mb-setvar phwmon_monitor=true;$PHWRUN;$me") fi out+=("^sep()") [[ $phwmon_cpu = false ]] && out+=("CPU,mb-setvar phwmon_cpu=true;$PHWRUN;$me") || out+=("CPU,mb-setvar phwmon_cpu=false;$PHWRUN;$me") [[ $phwmon_mem = false ]] && out+=("$MEM,mb-setvar phwmon_mem=true;$PHWRUN;$me") || out+=("$MEM,mb-setvar phwmon_mem=false;$PHWRUN;$me") [[ $phwmon_swap = false ]] && out+=("Swap,mb-setvar phwmon_swap=true;$PHWRUN;$me") || out+=("Swap,mb-setvar phwmon_swap=false;$PHWRUN;$me") [[ $phwmon_net = false ]] && out+=("$NET,mb-setvar phwmon_net=true;$PHWRUN;$me") || out+=("$NET,mb-setvar phwmon_net=false;$PHWRUN;$me") [[ $phwmon_io = false ]] && out+=("$DISC_IO,mb-setvar phwmon_io=true;$PHWRUN;$me") || out+=("$DISC_IO,mb-setvar phwmon_io=false;$PHWRUN;$me") fi #out+=("^sep($EDIT_TINT2)") # out+=("^sep()") out+=("^sep($TITLE)") out+=("$CHOOSE_TINT2,$TZEN") out+=("$RESTART_TINT2,mb-tint2restart") out+=("$RELOAD_TINT2,killall -SIGUSR1 tint2") if [ $1 == "-s" ]; then . /usr/share/mb-jgtools/pipemenu-standalone.cfg . $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 MENU_PADDING_TOP=${jgtools_padding:-0} 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 POSITION_MODE=${2:-center} mkconfigfile cat < ${MENU_ITEMS} $(printf '%s\n' "${out[@]}") $(printf '%s\n' "${out2[@]}") EOF jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null exit 0 fi printf '%s\n' "${out[@]}" printf '%s\n' "${out2[@]}" if [ "$1" == "-r" ]; then printf '%s\n' "^sep()" printf '%s\n' "$REMOVE,mb-setvar places_tint2pipe=false;mb-jgtools places" fi