From 37a0fcb5e407b8d7852c0d90500388d57c3213e1 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Thu, 27 Oct 2022 01:10:17 +0200 Subject: [PATCH] conky module update --- bin/colorizer-conky | 2 +- bin/conky_getactiveinet.sh | 27 ++++++++ bin/conkyctl | 126 +++++++++++++++++++++++++++---------- bin/conkymountpoints.sh | 2 +- bin/w2theme | 20 ++++++ 5 files changed, 142 insertions(+), 35 deletions(-) create mode 100755 bin/conky_getactiveinet.sh diff --git a/bin/colorizer-conky b/bin/colorizer-conky index 1910648..f5822d8 100755 --- a/bin/colorizer-conky +++ b/bin/colorizer-conky @@ -221,7 +221,7 @@ if pgrep -af "conky.*mbcolor" >/dev/null; then out2+=("$YES,rm $BASECONKY;$me") out2+=("^tag(resetcolors)") out2+=("^sep($AREYOUSURE)") - out2+=("$YES,conkyctl resetcolors;$me") + out2+=("$YES,conkyctl resetcolorsall;$me") else out+=("^sep(No supported Conky running)") diff --git a/bin/conky_getactiveinet.sh b/bin/conky_getactiveinet.sh new file mode 100755 index 0000000..0a12044 --- /dev/null +++ b/bin/conky_getactiveinet.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +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} diff --git a/bin/conkyctl b/bin/conkyctl index cb18ff0..f921eae 100755 --- a/bin/conkyctl +++ b/bin/conkyctl @@ -239,18 +239,47 @@ restartone () { kill ${1} startone ${1} } -makemovableall () { -echo "dupa" +makemoveableall () { + sd "own_window_type.*$" "own_window_type = 'normal'," ${CONKYDIR}/*mbcolor.conkyrc + cmd=( + yad --center --borders=20 + --title="Move Conkies where you want" + --text="Move Conkies to desired locations now...\n Hold Alt and drag Conkies one by one.\n" + --button="Cancel":1 + --button="Save new positions":0 + ) + "${cmd[@]}" + exval=$? + case $exval in + 1) makedesktoptypeall;; + 0) saveposall;; + 252) makedesktoptypeall;; + esac } -resetcolors () { +saveposall () { + # save new positions here + makedesktoptypeall +} +makedesktoptypeall () { + sd "own_window_type.*$" "own_window_type = 'desktop'," ${CONKYDIR}/*mbcolor.conkyrc +} +resetcolorsall () { transparent_all false win_bgcolor_all '#142c2c' - draw_borders_all true - stippled_borders_all 0 + #draw_borders_all true + #stippled_borders_all 0 default_color_all '#309552' color0_all '#accdc7' color1_all '#61c4bc' - color2_all '#61c4bc' + color2_all '#3dd425' +} +resetcolorsone () { + transparent false "${1}" + win_bgcolor '#142c2c' "${1}" + default_color '#309552' "${1}" + color0 '#accdc7' "${1}" + color1 '#61c4bc' "${1}" + color2 '#3dd425' "${1}" } languages () { @@ -276,6 +305,11 @@ languages () { COLOR_1="Kolor 1 (większy tekst)" COLOR_2="Kolor 2 (pasek/graf)" BACKGROUND="Kolor tła" + REGENERATE="(Re)Generuj kolory" + LIGHTBG="light - jasne tło" + DARKBG="dark - ciemne tło" + RESETCOLORS="Przywróć domyślne kolory" + GENFROMWP="Generuj z kolorów tapety" TRANSPARENT="Przezroczyste?" YES="Tak" NO="Nie" @@ -288,6 +322,7 @@ languages () { DRAW="Rysuj" BORDERS="Obramowanie" EDIT="Edytuj plik" + RELOAD="Przeładuj" KILL="Zabij" LOGOSIZE="Rozmiar logo" SMALL="Małe" @@ -318,6 +353,11 @@ languages () { COLOR_1="Color 1 (bigger text)" COLOR_2="Color 2 (bars/graphs)" BACKGROUND="Background color" + REGENERATE="(Re)Generate colors" + LIGHTBG="light" + DARKBG="dark" + RESETCOLORS="Restore default colors" + GENFROMWP="Generate from wallpaper" TRANSPARENT="Transparent?" YES="Yes" NO="No" @@ -330,6 +370,7 @@ languages () { DRAW="Deaw" BORDERS="Borders" EDIT="Edit file" + RELOAD="Reload" KILL="Kill" LOGOSIZE="Logo size" SMALL="Small" @@ -388,32 +429,35 @@ single () { if [[ "$1" =~ "etwork_mbcolor" ]]; then out+=("$NOT_WORKING,conkyctl netdevice") fi - out+=("^sep($POSITION)") - out+=(" $MARKNEWPOS,conkyctl setpos ${1};$me") - out+=("^sep()") - out+=("$ALIGNMENT [ $POS ],^checkout(pos)") - out2+=("^tag(pos)") + #out+=("^sep($POSITION)") + out+=(" $POSITION,^checkout(position)") + out2+=("^tag(position)") out2+=("^sep($POSITION)") - out2+=(" $TOPLEFT,conkyctl pos top_left ${1};$me") - out2+=(" $TOP,conkyctl pos top_middle ${1};$me") - out2+=(" $TOPRIGHT,conkyctl pos top_right ${1};$me") - out2+=(" $LEFT,conkyctl pos middle_left ${1};$me") - out2+=("$CENTER,conkyctl pos middle_middle ${1};$me") - out2+=(" $RIGHT,conkyctl pos middle_right ${1};$me") - out2+=(" $BOTTOMLEFT,conkyctl pos bottom_left ${1};$me") - out2+=(" $BOTTOM,conkyctl pos bottom_middle ${1};$me") - out2+=(" $BOTTOMRIGHT,conkyctl pos bottom_right ${1};$me") - out+=("$HORIZONTAL_GAP [ $GAPX ],^checkout(gapx)") - out2+=("^tag(gapx)") - out2+=("^sep($HORIZONTAL_GAP)") + out2+=(" $MARKNEWPOS,conkyctl setpos ${1};$me") + out2+=("^sep()") + out2+=("$ALIGNMENT [ $POS ],^checkout(posi)") + out3+=("^tag(posi)") + out3+=("^sep($POSITION)") + out3+=(" $TOPLEFT,conkyctl pos top_left ${1};$me") + out3+=(" $TOP,conkyctl pos top_middle ${1};$me") + out3+=(" $TOPRIGHT,conkyctl pos top_right ${1};$me") + out3+=(" $LEFT,conkyctl pos middle_left ${1};$me") + out3+=("$CENTER,conkyctl pos middle_middle ${1};$me") + out3+=(" $RIGHT,conkyctl pos middle_right ${1};$me") + out3+=(" $BOTTOMLEFT,conkyctl pos bottom_left ${1};$me") + out3+=(" $BOTTOM,conkyctl pos bottom_middle ${1};$me") + out3+=(" $BOTTOMRIGHT,conkyctl pos bottom_right ${1};$me") + out2+=("$HORIZONTAL_GAP [ $GAPX ],^checkout(gapx)") + out3+=("^tag(gapx)") + out3+=("^sep($HORIZONTAL_GAP)") for i in 0 10 20 30 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360; do - out2+=("${i},conkyctl gap_x ${i} ${1};$me") + out3+=("${i},conkyctl gap_x ${i} ${1};$me") done - out+=("$VERTICAL_GAP [ $GAPY ],^checkout(gapy)") - out2+=("^tag(gapy)") - out2+=("^sep($VERTICAL_GAP)") + out2+=("$VERTICAL_GAP [ $GAPY ],^checkout(gapy)") + out3+=("^tag(gapy)") + out3+=("^sep($VERTICAL_GAP)") for i in 0 10 20 30 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360; do - out2+=("${i},conkyctl gap_y ${i} ${1};$me") + out3+=("${i},conkyctl gap_y ${i} ${1};$me") done if [[ "$1" =~ "logo_mbcolor" ]]; then @@ -478,6 +522,16 @@ single () { out+=("transparent $BACKGROUND,^checkout(transsingle)") fi out+=("^sep()") + if [[ "$1" != *"logo_mbcolor"* ]]; then + out+=("$REGENERATE,^checkout(regensingle)") + out2+=("^tag(regensingle)") + out2+=("^sep($REGENERATE)") + out2+=("$RESETCOLORS,conkyctl resetcolorsone ${1}") + out2+=("^sep($GENFROMWP)") + out2+=("$LIGHTBG,w2theme conkyone light ${1}") + out2+=("$DARKBG,w2theme conkyone dark ${1}") + out+=("^sep()") + fi out2+=("^tag(transsingle)") out2+=("^sep($TRANSPARENT)") out2+=("$YES,conkyctl transparent true ${1};$me") @@ -520,6 +574,7 @@ single () { out+=("^sep()") out+=(" $EDIT ${title^},xdg-open ${1}") + out+=(" $RELOAD ${title^},conkyctl restartone ${1}") out+=("^sep()") out+=(" $KILL ${title^},conkyctl kill ${1##*/};${me}") } @@ -527,6 +582,7 @@ pipemenu () { single "$1" printf '%s\n' "${out[@]}" printf '%s\n' "${out2[@]}" + printf '%s\n' "${out3[@]}" exit 0 } @@ -618,6 +674,7 @@ ${CUSTOMCOMMANDS} $(printf '%s\n' "${out[@]}") ⮜⮜⮜ Colorizer Conky,colorizer-conky -s $(printf '%s\n' "${out2[@]}") +$(printf '%s\n' "${out3[@]}") EOF else cat < ${MENU_ITEMS} @@ -628,6 +685,7 @@ $(printf '%s\n' "${out[@]}") ${CUSTOMCOMMANDS} $EDIT_CUSTOMCOMMANDS,touch ~/.config/mabox/${name}.csv;sleep 1;xdg-open ~/.config/mabox/${name}.csv $(printf '%s\n' "${out2[@]}") +$(printf '%s\n' "${out3[@]}") EOF fi else @@ -639,6 +697,7 @@ $(printf '%s\n' "${out[@]}") ${CUSTOMCOMMANDS} $EDIT_CUSTOMCOMMANDS,touch ~/.config/mabox/${name}.csv;sleep 1;xdg-open ~/.config/mabox/${name}.csv $(printf '%s\n' "${out2[@]}") +$(printf '%s\n' "${out3[@]}") EOF fi @@ -672,12 +731,12 @@ esac cat <> /tmp/xx00 conky.text = [[ \${color}$NETWORK -\${color}$DEVICE \${alignr}$IFACE -\${color}$IP \${alignr}\${addr $IFACE} +\${color}$DEVICE \${alignr}\${color0}$IFACE +\${color}$IP \${alignr}\${color0}\${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} +\${color0}\${hr} \${execi 30 netstat -ept | grep ESTAB | awk '{print \$9}' | cut -d/ -f2 | sort | uniq -c | sort -nr} ]]; EOF @@ -721,9 +780,10 @@ case "$1" in kill) kill "$2";; restartone) restartone "$2";; contextmenu) contextmenu;; - makemovableall) makemovableall;; + makemoveableall) makemoveableall;; saveposall) saveposall;; - resetcolors) resetcolors ;; + resetcolorsall) resetcolorsall ;; + resetcolorsone) resetcolorsone "$2";; netdevice) netdevice ;; *) : ;; esac diff --git a/bin/conkymountpoints.sh b/bin/conkymountpoints.sh index 968fb15..6102602 100755 --- a/bin/conkymountpoints.sh +++ b/bin/conkymountpoints.sh @@ -11,7 +11,7 @@ case "$LANG" in pl*) MOUNTPOINTS="Punkty montowania" USED="użyte" - SIZE="rozmir" + SIZE="rozmiar" ;; *) MOUNTPOINTS="MOUNT POINTS" diff --git a/bin/w2theme b/bin/w2theme index 8f1f142..3992dd9 100755 --- a/bin/w2theme +++ b/bin/w2theme @@ -77,6 +77,25 @@ conky_colors() { ;; esac } +conky_colorsone () { + source ~/.config/colorizer/colorizer.conf + case "$1" in + dark) #dark bg + conkyctl win_bgcolor "${w[0]}" "${2}" + conkyctl default_color "${w[-1]}" "${2}" + conkyctl color0 "${w[-3]}" "${2}" + conkyctl color1 "${w[-4]}" "${2}" + conkyctl color2 "${w[-5]}" "${2}" + ;; + *) #light bg + conkyctl win_bgcolor "${w[-1]}" "${2}" + conkyctl default_color "${w[0]}" "${2}" + conkyctl color0 "${w[2]}" "${2}" + conkyctl color1 "${w[4]}" "${2}" + conkyctl color2 "${w[6]}" "${2}" + ;; + esac +} pyradio_theme() { case "$1" in dark) #dark bg @@ -295,6 +314,7 @@ case "$1" in ob) obtheme "$2";; menu) menu_theme "$2";; conky) conky_colors "$2";; + conkyone) conky_colorsone "$2" "$3";; pyradio) pyradio_theme "$2";; accent) accent "$2";; gradient) gradient "$2" "$3";;