From cdb76a7eb5a71a65bf058ce7dc8ac2d8bc471d77 Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 28 Mar 2023 14:22:38 +0200 Subject: conkynet --- .local/bin/conky/net.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to '.local') diff --git a/.local/bin/conky/net.sh b/.local/bin/conky/net.sh index c997266..9536f52 100755 --- a/.local/bin/conky/net.sh +++ b/.local/bin/conky/net.sh @@ -16,6 +16,13 @@ case "$(hostname -s)" in ;; esac +if_wg="wg0" +if [ -e "/sys/class/net/$if_wg/operstate" ] && ! [ -z $(ifconfig $if_wg 2>/dev/null | awk '/inet / {print $2}') ]; then + : +else + if_wg="" +fi + if grep up "/sys/class/net/$if_main/operstate" >/dev/null 2>&1 && ! [ -z $(ifconfig $if_main 2>/dev/null | awk '/inet / {print $2}') ]; then : elif grep up "/sys/class/net/$if_alt/operstate" >/dev/null 2>&1 && ! [ -z $(ifconfig $if_alt 2>/dev/null | awk '/inet / {print $2}') ]; then @@ -27,11 +34,15 @@ ${color1}No network${font}' fi echo '${color1}${font1}NET ${hr 2}${font} -${color1}Interface: ${font2}${color0}'$if_main'${font} -${color1}--------- -${color1}LAN IP: ${font2}${color0}${addr '$if_main'}${font} -${color1}DNS IP: ${font2}${color0}${nameserver 0}${font} -${color1}WAN IP: ${color0}${font2}${execi 300 curl -s https://ifconfig.me || echo No WAN}${font} +${color1}Interface: ${font2}${color0}'$if_main'${font}' + +[ -z $if_wg ] || echo '${color1}WireGuard: ${color0}${font2}ON${font}' + +echo '${color1}--------- +${color1}LAN IP: ${font2}${color0}${addr '$if_main'}${font}' +[ -z $if_wg ] || echo '${color1}WG IP: ${color0}${font2}${addr '$if_wg'}${font}' +echo '${color1}DNS IP: ${font2}${color0}${nameserver 0}${font}' +echo '${color1}WAN IP: ${color0}${font2}${execi 15 curl -s https://ifconfig.me || echo No WAN}${font} ${color1}--------- ${color1}D: ${color0}${font2}${downspeed '$if_main'}${font}${color1} -- Total: ${color0}${font2}${totaldown '$if_main'}${font} ${color1}U: ${color0}${font2}${upspeed '$if_main'}${font}${color1} -- Total: ${color0}${font2}${totalup '$if_main'}${font}' -- cgit v1.2.3