tint2 pipe

master
Daniel Napora 2023-01-15 17:07:01 +01:00
parent d2ed26cb4b
commit 70cbf539e9
1 changed files with 175 additions and 26 deletions

View File

@ -10,7 +10,8 @@ me="jgtint2-pipe -s"
case $LANG in
pl*)
LNG="pl"
TITLE="Panel Tint2"
TITLE="Konfiguracja Paneli Tint2"
PANEL="Panel"
POSITION="Pozycja"
SIZE="Rozmiar"
WIDTH="Szerokość"
@ -21,10 +22,31 @@ case $LANG in
AUTOHIDE="Autoukrywanie ?"
SIZEHIDDEN="Rozmiar gdy ukryty"
ICONS="Ikony"
CLOCK="Zegar"
CLOCK_LINE1="Zegar linia 1"
CLOCK_LINE2="Zegar linia 2"
NONE="brak"
RESET="Resetuj"
TASKBAR="Pasek zadań i przyciski"
MOUSE_EVENTS="Akcje myszy"
RESETMOUSE="Przywróć domyślne"
MOUSE_LEFT="Lewy klik"
MOUSE_RIGHT="Prawy klik"
MOUSE_MIDDLE="Środkowy klik"
MOUSE_UP="Kółko Góra"
MOUSE_DOWN="Kółko Dół"
APPEARANCE="Wygląd przycisków"
SHOW_BOTH="Ikony i tekst"
SHOW_ICON="Ikony"
SHOW_TEXT="Tekst"
CENTER_TEXT="Tekst wycentrowany"
BUTTON_WIDTH="Wielkość przycisku"
FILL="Wypełnij pasek zadań"
FITICON="Jak ikony"
TOOLTIPS="Podpowiedzi..."
TOOLTIPS_NONE="Nie pokazuj"
SHOW_TOOLTIPS="Podpowiedzi"
THUMBNAILS="Podpowiedz i Miniaturki"
RESET="Resetuj panel"
TOP="Góra"
BOTTOM="Dół"
TOPLEFT="Góra po lewej"
@ -40,6 +62,7 @@ case $LANG in
NO="Nie (0)"
RUNNING_TINT2="Działające Tint2"
DEFAULT_TINT2RC="Domyślny tint2rc"
ADVANCED="Zaawansowane..."
EDIT_TINT2="Edytuj plik konfiguracyjny"
APPS="Programy (Launcher)"
LAUNCHERS="Dodaj/usuń programy..."
@ -60,6 +83,7 @@ case $LANG in
es*)
LNG="en"
TITLE="Panel Tint2"
PANEL="Panel"
POSITION="Position"
SIZE="Size"
WIDTH="Width"
@ -70,10 +94,31 @@ case $LANG in
AUTOHIDE="Autohide?"
SIZEHIDDEN="Size when hidden:"
ICONS="Icon theme"
CLOCK="Clock"
CLOCK_LINE1="Clock line 1"
CLOCK_LINE2="Clock line 2"
NONE="none"
RESET="Reset to default"
TASKBAR="Taskbar Buttons"
MOUSE_EVENTS="Mouse events"
RESETMOUSE="Reset to defaults"
MOUSE_LEFT="Left click"
MOUSE_RIGHT="Right click"
MOUSE_MIDDLE="Middle click"
MOUSE_UP="Wheel Up"
MOUSE_DOWN="Wheel Down"
APPEARANCE="Buttons Appearance"
SHOW_BOTH="Icons and text"
SHOW_ICON="Show icon"
SHOW_TEXT="Show text"
CENTER_TEXT="Center text"
BUTTON_WIDTH="Button width"
FILL="Fill taskbar"
FITICON="Fit icon size"
TOOLTIPS_NONE="None"
TOOLTIPS="Tooltips..."
SHOW_TOOLTIPS="Show tooltips"
THUMBNAILS="Thumbnails"
RESET="Reset panel to defaults"
TOP="Top"
BOTTOM="Bottom"
TOPLEFT="TopLeft"
@ -89,6 +134,7 @@ case $LANG in
NO="No (0)"
RUNNING_TINT2="Panel(es) en ejecución"
DEFAULT_TINT2RC="Panel tint2rc x defecto"
ADVANCED="Advanced..."
EDIT_TINT2="Edición manual panel"
APPS="Launchers"
LAUNCHERS="Add/Remove Launchers..."
@ -108,7 +154,8 @@ case $LANG in
;;
*)
LNG="en"
TITLE="Tint2 Panel"
TITLE="Configure Tint2 Panels"
PANEL="Panel"
POSITION="Position"
SIZE="Size"
WIDTH="Width"
@ -119,10 +166,31 @@ case $LANG in
AUTOHIDE="Autohide?"
SIZEHIDDEN="Size when hidden:"
ICONS="Icon theme"
CLOCK="Clock"
CLOCK_LINE1="Clock line 1"
CLOCK_LINE2="Clock line 2"
NONE="none"
RESET="Reset to default"
TASKBAR="Taskbar Buttons"
MOUSE_EVENTS="Mouse events"
RESETMOUSE="Reset to defaults"
MOUSE_LEFT="Left click"
MOUSE_RIGHT="Right click"
MOUSE_MIDDLE="Middle click"
MOUSE_UP="Wheel Up"
MOUSE_DOWN="Wheel Down"
APPEARANCE="Buttons Appearance"
SHOW_BOTH="Icons and text"
SHOW_ICON="Icon only"
SHOW_TEXT="Text only"
CENTER_TEXT="Centered"
BUTTON_WIDTH="Button width"
FILL="Fill taskbar"
FITICON="Fit icon size"
TOOLTIPS="Tooltips..."
TOOLTIPS_NONE="None"
SHOW_TOOLTIPS="Only tooltips"
THUMBNAILS="Tooltips and Thumbnails"
RESET="Reset panel to defaults"
TOP="Top"
BOTTOM="Bottom"
TOPLEFT="TopLeft"
@ -138,6 +206,7 @@ case $LANG in
NO="No (0)"
RUNNING_TINT2="Running Tint2"
DEFAULT_TINT2RC="Default tint2rc"
ADVANCED="Advanced..."
EDIT_TINT2="Edit config file"
APPS="Launchers"
LAUNCHERS="Add/Remove Launchers..."
@ -165,8 +234,7 @@ getvalues () {
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 () {
@ -180,7 +248,10 @@ qactions () {
out+=("$ICONS [ <b>$ICONTHEME</b> ],^checkout(iconthemes$i)")
# Clock
if [[ "$PANELITEMS" == *C* ]]; then
out+=("^sep()")
read TF1 <<< "$(grep "time1_format" ${TINT} | cut -d'=' -f2)"
read TF2 <<< "$(grep "time2_format" ${TINT} | cut -d'=' -f2)"
out+=("^sep($CLOCK)")
out+=("$CLOCK_LINE1 [ <b> $(date "+${TF1}") </b> ],^checkout(cl1)")
out+=("$CLOCK_LINE2 [ <b> $(date "+${TF2}") </b> ],^checkout(cl2)")
out2+=("^tag(cl1)")
@ -199,16 +270,84 @@ qactions () {
out2+=("<b>$(date +"%x")</b> <small>(%x)</small>,t2ctl clockline2 '%x' ${TINT};$me")
out2+=("<b>$(date +"%m-%d-%Y")</b> <small>(%m-%d-%Y)</small>,t2ctl clockline2 '%m-%d-%Y' ${TINT};$me")
out2+=("<b>$(date +"%F")</b> <small>(%F)</small>,t2ctl clockline2 '%F' ${TINT};$me")
fi
# END Clock
# Taskbar
if [[ "$PANELITEMS" == *T* ]]; then
read TEXT <<< "$(grep task_text ${TINT} | cut -d'=' -f2)"
read ICON <<< "$(grep 'task_icon ' ${TINT} | cut -d'=' -f2)"
read CENTERED <<< "$(grep 'task_centered' ${TINT} | cut -d'=' -f2)"
read TOOLTIP <<< "$(grep 'task_tooltip' ${TINT} | cut -d'=' -f2)"
read THUMBNAIL <<< "$(grep 'task_thumbnail' ${TINT} | cut -d'=' -f2)"
read TB_WIDTH TB_HEIGHT <<< "$(grep 'task_maximum_size' ${TINT} | cut -d'=' -f2)"
read MLEFT <<< "$(grep 'mouse_left' ${TINT} | cut -d'=' -f2)"
read MMIDDLE <<< "$(grep 'mouse_middle' ${TINT} | cut -d'=' -f2)"
read MRIGHT <<< "$(grep 'mouse_right' ${TINT} | cut -d'=' -f2)"
read MUP <<< "$(grep 'mouse_scroll_up' ${TINT} | cut -d'=' -f2)"
read MDOWN <<< "$(grep 'mouse_scroll_down' ${TINT} | cut -d'=' -f2)"
out+=("^sep($TASKBAR)")
out+=("$APPEARANCE,^checkout(taskappearance$i)")
out+=("<big></big> $MOUSE_EVENTS,^checkout(mouseevents$i)")
mouseactions=(none close toggle iconify shade toggle_iconify maximize_restore desktop_left desktop_right next_task prev_task)
out2+=("^tag(mouseevents$i)")
out2+=("^sep($MOUSE_EVENTS)")
out2+=("$RESETMOUSE,t2ctl mousereset ${TINT};$me")
out2+=("^sep()")
out2+=("<tt>$(printf "%-16s %1s" "$MOUSE_LEFT" "[ <b>$MLEFT</b> ]")</tt>,^checkout(mleft)")
out2+=("<tt>$(printf "%-16s %1s" "$MOUSE_RIGHT" "[ <b>$MRIGHT</b> ]")</tt>,^checkout(mright)")
out2+=("<tt>$(printf "%-16s %1s" "$MOUSE_MIDDLE" "[ <b>$MMIDDLE</b> ]")</tt>,^checkout(mmiddle)")
out2+=("<tt>$(printf "%-16s %1s" "$MOUSE_UP" "[ <b>$MUP</b> ]")</tt>,^checkout(mup)")
out2+=("<tt>$(printf "%-16s %1s" "$MOUSE_DOWN" "[ <b>$MDOWN</b> ]")</tt>,^checkout(mdown)")
out3+=("^tag(mleft)" "^sep($MOUSE_LEFT)")
for n in "${mouseactions[@]}";do out3+=("$n,t2ctl mleft $n ${TINT};$me"); done
out3+=("^tag(mright)" "^sep($MOUSE_RIGHT)")
for n in "${mouseactions[@]}";do out3+=("$n,t2ctl mright $n ${TINT};$me"); done
out3+=("^tag(mmiddle)" "^sep($MOUSE_MIDDLE)")
for n in "${mouseactions[@]}";do out3+=("$n,t2ctl mmiddle $n ${TINT};$me"); done
out3+=("^tag(mup)" "^sep($MOUSE_UP)")
for n in "${mouseactions[@]}";do out3+=("$n,t2ctl mup $n ${TINT};$me"); done
out3+=("^tag(mdown)" "^sep($MOUSE_DOWN)")
for n in "${mouseactions[@]}";do out3+=("$n,t2ctl mdown $n ${TINT};$me"); done
out+=("^sep()")
if [ -f "/usr/share/mabox/lang/${LNG}/.config/tint2/${TINT2}" ];then
out+=("$RESET,t2ctl reset ${TINT2};me")
out+=("^sep()")
fi
out2+=("^tag(taskappearance$i)")
out2+=("^sep($APPEARANCE)")
[[ "$ICON" = 1 && "$TEXT" = 1 ]] && out2+=("<big>綠</big> $SHOW_BOTH,$me")||out2+=("<big>祿</big> $SHOW_BOTH,t2ctl tb_both 1 ${TINT};$me")
[[ "$ICON" = 1 && "$TEXT" = 0 ]] && out2+=("<big>綠</big> $SHOW_ICON,$me")||out2+=("<big>祿</big> $SHOW_ICON,t2ctl tb_icon 1 ${TINT};$me")
[[ "$TEXT" = 1 && "$ICON" = 0 ]] && out2+=("<big>綠</big> $SHOW_TEXT,$me")||out2+=("<big>祿</big> $SHOW_TEXT,t2ctl tb_text 1 ${TINT};$me")
out2+=("^sep()")
[[ "$CENTERED" = 1 ]] && out2+=("<big></big> $CENTER_TEXT,t2ctl tb_centered 0 ${TINT};$me")||out2+=("<big></big> $CENTER_TEXT,t2ctl tb_centered 1 ${TINT};$me")
out2+=("^sep()")
out2+=("$BUTTON_WIDTH [ <b>$TB_WIDTH</b> ],^checkout(tbwidth)")
out3+=("^tag(tbwidth)")
out3+=("^sep($BUTTON_WIDTH)")
out3+=("$FILL,t2ctl tb_width 0 ${TINT};$me")
out3+=("^sep()")
out3+=("$FITICON,t2ctl tb_width icon ${TINT};$me")
out3+=("^sep()")
out3+=("100,t2ctl tb_width 100 ${TINT};$me")
out3+=("120,t2ctl tb_width 120 ${TINT};$me")
out3+=("150,t2ctl tb_width 150 ${TINT};$me")
out3+=("200,t2ctl tb_width 200 ${TINT};$me")
out2+=("^sep($TOOLTIPS)")
[[ "$TOOLTIP" = 0 && "$THUMBNAIL" = 0 ]] && out2+=("<big>綠</big> $TOOLTIPS_NONE,t2ctl tb_tooltip_none 0 ${TINT};$me")||out2+=("<big>祿</big> $TOOLTIPS_NONE,t2ctl tb_tooltip_none 1 ${TINT};$me")
[[ "$TOOLTIP" = 1 && "$THUMBNAIL" = 0 ]] && out2+=("<big>綠</big> $SHOW_TOOLTIPS,t2ctl tb_tooltip 0 ${TINT};$me")||out2+=("<big>祿</big> $SHOW_TOOLTIPS,t2ctl tb_tooltip 1 ${TINT};$me")
[[ "$TOOLTIP" = 1 && "$THUMBNAIL" = 1 ]] && out2+=("<big>綠</big> $THUMBNAILS,t2ctl tb_thumbnail 0 ${TINT};$me")||out2+=("<big>祿</big> $THUMBNAILS,t2ctl tb_thumbnail 1 ${TINT};$me")
out2+=("")
fi
out2+=("^tag(iconthemes$i)")
for item in "/usr/share/icons"/*; do
if [[ -d $item ]]; then
@ -302,10 +441,10 @@ qactions () {
}
out+=("^sep($TITLE)")
out+=("^sep($APPS)")
out+=("$LAUNCHERS,jgtint2launcher")
out+=("  $LAUNCHERS,jgtint2launcher")
if [ "$(pidof tint2)" ];then
i=0
out+=("^sep($TINT2_CONFIGURE)")
#out+=("^sep($TINT2_CONFIGURE)")
while read -r pid cmd; do
if [[ ${cmd%% *} = tint2 ]]; then
TINT=${cmd##* }
@ -314,13 +453,17 @@ out+=("^sep($TINT2_CONFIGURE)")
TINT="$TINT2RC"
TINT2="$DEFAULT_TINT2RC"
fi
out+=("^sep($TINT2)")
out+=("^sep($PANEL: <i>$TINT2</i>)")
((i=i+1))
getvalues
qactions
out+=("$CONFIGURE <i>$TINT2</i>,tint2conf $TINT")
out+=("$EDIT_TINT2 <i>$TINT2</i>,geany $TINT")
out+=("^sep($ADVANCED)")
out+=(" $EDIT_TINT2 <i>$TINT2</i>,geany $TINT")
out+=(" $CONFIGURE <i>$TINT2</i>,tint2conf $TINT")
if [ -f "/usr/share/mabox/lang/${LNG}/.config/tint2/${TINT2}" ];then
out+=("^sep()")
out+=("$RESET <i>$TINT2</i>,,t2ctl reset ${TINT2};me")
fi
fi
done < <(pgrep -a tint2)
@ -336,15 +479,19 @@ PHWRUN="mabox-obstart phwmon"
out+=("^sep($TRAY_HWMON)")
if [ "$(pgrep -f phwmon.py)" ];then
out+=("$STOP,mb-setvar phwmon_monitor=false;sleep 2;$PHWRUN;$me")
out+=("^sep()")
[[ $phwmon_cpu = false ]] && out+=("<big></big> <i><s>CPU</s></i>,mb-setvar phwmon_cpu=true;$PHWRUN;$me") || out+=("<big></big> CPU,mb-setvar phwmon_cpu=false;$PHWRUN;$me")
[[ $phwmon_mem = false ]] && out+=("<big></big> <i><s>$MEM</s></i>,mb-setvar phwmon_mem=true;$PHWRUN;$me") || out+=("<big></big> $MEM,mb-setvar phwmon_mem=false;$PHWRUN;$me")
SW=$(swapon -s|wc -l)
if [[ "$SW" > 0 ]];then
[[ $phwmon_swap = false ]] && out+=("<big></big> <i><s>Swap</s></i>,mb-setvar phwmon_swap=true;$PHWRUN;$me") || out+=("<big></big> Swap,mb-setvar phwmon_swap=false;$PHWRUN;$me")
fi
[[ $phwmon_net = false ]] && out+=("<big></big> <i><s>$NET</s></i>,mb-setvar phwmon_net=true;$PHWRUN;$me") || out+=("<big></big> $NET,mb-setvar phwmon_net=false;$PHWRUN;$me")
[[ $phwmon_io = false ]] && out+=("<big></big> <i><s>$DISC_IO</s></i>,mb-setvar phwmon_io=true;$PHWRUN;$me") || out+=("<big></big> $DISC_IO,mb-setvar phwmon_io=false;$PHWRUN;$me")
else
out+=("$START,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>$MEM</s></i>,mb-setvar phwmon_mem=true;$PHWRUN;$me") || out+=("$MEM,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>$NET</s></i>,mb-setvar phwmon_net=true;$PHWRUN;$me") || out+=("$NET,mb-setvar phwmon_net=false;$PHWRUN;$me")
[[ $phwmon_io = false ]] && out+=("<i><s>$DISC_IO</s></i>,mb-setvar phwmon_io=true;$PHWRUN;$me") || out+=("$DISC_IO,mb-setvar phwmon_io=false;$PHWRUN;$me")
fi
#out+=("^sep($EDIT_TINT2)")
@ -382,6 +529,7 @@ cat <<EOF > ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
$(printf '%s\n' "${out3[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
@ -392,6 +540,7 @@ fi
printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"
printf '%s\n' "${out3[@]}"
if [ "$1" == "-r" ]; then
printf '%s\n' "^sep()"