From b39ca7285331336f1400f34d580fc6b8df431652 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Mon, 17 Oct 2022 14:48:35 +0200 Subject: [PATCH] conky module improvements --- bin/colorizer-conky | 8 ++++- bin/conkyctl | 72 ++++++++++++++++++++++++++++++++++++++++- bin/conkymountpoints.sh | 15 ++++++++- 3 files changed, 92 insertions(+), 3 deletions(-) diff --git a/bin/colorizer-conky b/bin/colorizer-conky index e9955ea..1910648 100755 --- a/bin/colorizer-conky +++ b/bin/colorizer-conky @@ -51,6 +51,7 @@ case "$LANG" in STARTALL="Uruchom wszystkie" RESET="Resetuj" RESETALL="Resetuj wszystkie" + RESETCOLORS="Przywróć domyślne kolory" AREYOUSURE="Czy aby napewno?" ;; *) @@ -83,6 +84,7 @@ case "$LANG" in STARTALL="Start all" RESET="Reset" RESETALL="Reset all to defaults" + RESETCOLORS="Restore default colors" AREYOUSURE="Are you sure?" ;; esac @@ -178,7 +180,7 @@ if pgrep -af "conky.*mbcolor" >/dev/null; then #done < <(pgrep -af "conky.*mbcolor") # array with running conkies - only filenames with full path - readarray -t running < <(pgrep -af "conky.*mbcolor" | cut -d' ' -f4) + readarray -t running < <(pgrep -af "conky -c.*mbcolor" | cut -d' ' -f4) #array with all supported conkies for i in "$CONKYDIR"/*_mbcolor*; do @@ -212,10 +214,14 @@ if pgrep -af "conky.*mbcolor" >/dev/null; then fi fi out+=("^sep($RESET)") + out+=(" $RESETCOLORS,^checkout(resetcolors)") out+=(" $RESETALL,^checkout(resetall)") out2+=("^tag(resetall)") out2+=("^sep($AREYOUSURE)") out2+=("$YES,rm $BASECONKY;$me") + out2+=("^tag(resetcolors)") + out2+=("^sep($AREYOUSURE)") + out2+=("$YES,conkyctl resetcolors;$me") else out+=("^sep(No supported Conky running)") diff --git a/bin/conkyctl b/bin/conkyctl index 69c65e0..cb18ff0 100755 --- a/bin/conkyctl +++ b/bin/conkyctl @@ -295,6 +295,7 @@ languages () { BIG="Duże" STIPPLED_BORDERS="Nakrapiane" SOLID_LINE="linia ciągła" + NOT_WORKING="Nie działa? Naprawmy to :)" ;; *) POSITION="Position" @@ -336,6 +337,7 @@ languages () { BIG="Big" STIPPLED_BORDERS="Stippled borders" SOLID_LINE="solid line" + NOT_WORKING="Not working? Try to fix" ;; esac } @@ -383,6 +385,9 @@ single () { [[ "$WINTRANS" == false ]] && BG="bgcolor='$WINCLR'" || BG="" out+=("^sep(Conky: [ ${title^} ])") + if [[ "$1" =~ "etwork_mbcolor" ]]; then + out+=("$NOT_WORKING,conkyctl netdevice") + fi out+=("^sep($POSITION)") out+=(" $MARKNEWPOS,conkyctl setpos ${1};$me") out+=("^sep()") @@ -603,7 +608,18 @@ contextmenu () { EDIT_CUSTOMCOMMANDS=" Edit custom commands" ;; esac - +if [ -f $HOME/.config/mabox/${name}.csv ]; then +LINES=$(cat $HOME/.config/mabox/${name}.csv|wc -l) +if [ "$LINES" -gt "0" ]; then +cat < ${MENU_ITEMS} +${CUSTOMCOMMANDS} +^sep() +$EDIT_CUSTOMCOMMANDS,touch ~/.config/mabox/${name}.csv;sleep 1;xdg-open ~/.config/mabox/${name}.csv +$(printf '%s\n' "${out[@]}") + ⮜⮜⮜ Colorizer Conky,colorizer-conky -s +$(printf '%s\n' "${out2[@]}") +EOF +else cat < ${MENU_ITEMS} $(printf '%s\n' "${out[@]}") ^sep() @@ -613,9 +629,62 @@ ${CUSTOMCOMMANDS} $EDIT_CUSTOMCOMMANDS,touch ~/.config/mabox/${name}.csv;sleep 1;xdg-open ~/.config/mabox/${name}.csv $(printf '%s\n' "${out2[@]}") EOF +fi +else +cat < ${MENU_ITEMS} +$(printf '%s\n' "${out[@]}") +^sep() + ⮜⮜⮜ Colorizer Conky,colorizer-conky -s +^sep($CUSTOM_COMMANDS_SEP) +${CUSTOMCOMMANDS} +$EDIT_CUSTOMCOMMANDS,touch ~/.config/mabox/${name}.csv;sleep 1;xdg-open ~/.config/mabox/${name}.csv +$(printf '%s\n' "${out2[@]}") +EOF +fi + jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null } +netdevice () { +CFGFILE="$HOME/.config/conky/Network_mbcolor.conkyrc" +rm /tmp/xx* +cd /tmp + +csplit -s ${CFGFILE} /conky.text/ + +#IFACE=$(ip route get 8.8.8.8 | awk -- '{printf $5}') +IFACE=$(ip route get 8.8.8.8 | awk '{for(i=1; i> /tmp/xx00 +conky.text = [[ +\${color}$NETWORK +\${color}$DEVICE \${alignr}$IFACE +\${color}$IP \${alignr}\${addr $IFACE} +\${color}$DOWNLOAD \$color0\${downspeed $IFACE} \${alignr}\${color0}\${upspeed $IFACE}\${color} Upload +\${color2}\${downspeedgraph $IFACE 30,100 -t} \${alignr} \${upspeedgraph $IFACE 30,100 -t} +\${color}Total Down \${color0}\${totaldown $IFACE} \${alignr}\${color0}\${totalup $IFACE}\${color} Total Up +\${color}\${hr} +\${execi 30 netstat -ept | grep ESTAB | awk '{print \$9}' | cut -d/ -f2 | sort | uniq -c | sort -nr} +]]; +EOF + +cat /tmp/xx00 > ${CFGFILE} +} + case "$1" in transparent_all) transparent_all "$2";; transparent) transparent "$2" "$3";; @@ -655,5 +724,6 @@ case "$1" in makemovableall) makemovableall;; saveposall) saveposall;; resetcolors) resetcolors ;; + netdevice) netdevice ;; *) : ;; esac diff --git a/bin/conkymountpoints.sh b/bin/conkymountpoints.sh index 31b28d5..968fb15 100755 --- a/bin/conkymountpoints.sh +++ b/bin/conkymountpoints.sh @@ -7,5 +7,18 @@ do echo "$MOUNTLBL\${goto 90}\${color2}\${fs_bar 6,64 $MOUNT}\${color}\${goto 160}$USED\${goto 200}$PERCENT\${alignr}$SIZE" done } -echo "\${goto 160}used\${goto 200}%\${alignr}size" +case "$LANG" in + pl*) + MOUNTPOINTS="Punkty montowania" + USED="użyte" + SIZE="rozmir" + ;; + *) + MOUNTPOINTS="MOUNT POINTS" + USED="used" + SIZE="size" + ;; +esac +echo "$MOUNTPOINTS" +echo "\${goto 160}$USED\${goto 200}%\${alignr}$SIZE" getdata