conky module improvements

master 0.9.2
Daniel Napora 2022-10-17 14:48:35 +02:00
parent f132019078
commit b39ca72853
3 changed files with 92 additions and 3 deletions

View File

@ -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)")

View File

@ -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 <<EOF > ${MENU_ITEMS}
${CUSTOMCOMMANDS}
^sep()
<small>$EDIT_CUSTOMCOMMANDS</small>,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 <<EOF > ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}")
^sep()
@ -613,9 +629,62 @@ ${CUSTOMCOMMANDS}
<small>$EDIT_CUSTOMCOMMANDS</small>,touch ~/.config/mabox/${name}.csv;sleep 1;xdg-open ~/.config/mabox/${name}.csv
$(printf '%s\n' "${out2[@]}")
EOF
fi
else
cat <<EOF > ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}")
^sep()
⮜⮜⮜ Colorizer Conky,colorizer-conky -s
^sep($CUSTOM_COMMANDS_SEP)
${CUSTOMCOMMANDS}
<small>$EDIT_CUSTOMCOMMANDS</small>,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<NF; i++) {if($i=="dev") dev=i+1} print $dev}')
case "$LANG" in
pl*)
NETWORK="SIEĆ"
DEVICE="Urządzenie"
IP="Adres IP"
DOWNLOAD="Pobieranie"
;;
*)
NETWORK="NETWORK"
DEVICE="Device"
IP="IP"
DOWNLOAD="Download"
;;
esac
cat <<EOF >> /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

View File

@ -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