summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rrbo@proton.me>2023-02-13 10:46:54 +0100
committerJoe <rrbo@proton.me>2023-02-13 10:46:54 +0100
commit1bf7728606159979e6e48f97f0cae38bf455ccf9 (patch)
tree6993478555e3bf70469c63a6128b957582074031
parentup (diff)
downloaddotfiles-bsd-1bf7728606159979e6e48f97f0cae38bf455ccf9.tar.gz
dotfiles-bsd-1bf7728606159979e6e48f97f0cae38bf455ccf9.tar.bz2
dotfiles-bsd-1bf7728606159979e6e48f97f0cae38bf455ccf9.tar.xz
dotfiles-bsd-1bf7728606159979e6e48f97f0cae38bf455ccf9.tar.zst
dotfiles-bsd-1bf7728606159979e6e48f97f0cae38bf455ccf9.zip
up
Diffstat (limited to '')
-rw-r--r--.config/conky/conkyrc3
-rwxr-xr-x.local/bin/conky/getif.sh33
-rwxr-xr-x.local/bin/conky/net.sh3
3 files changed, 36 insertions, 3 deletions
diff --git a/.config/conky/conkyrc b/.config/conky/conkyrc
index 0746cae..f7d31a5 100644
--- a/.config/conky/conkyrc
+++ b/.config/conky/conkyrc
@@ -27,7 +27,7 @@ conky.config = {
draw_shades = false,
default_shade_color = AAAAAA,
default_outline_color = AAAAAA,
- draw_graph_borders = false,
+ draw_graph_borders = true,
show_graph_scale = false,
show_graph_range = false,
alignment = 'top_left',
@@ -88,4 +88,5 @@ ${font2}${color #928374}${top_mem name 4} ${alignr}${top_mem pid 4} ${top_mem c
${color #928374}---------
${color #928374}Processes: ${font2}${color #ebdbb2}${processes}${font}
${execpi 5 ~/.local/bin/conky/net.sh}
+${color #ebdbb2}${downspeedgraph ${execp ~/.local/bin/conky/getif.sh} 50,185 bfbfbf c0c0c0 125829120 -t}${goto 195}${color #ebdbb2}${upspeedgraph ${exec ~/.local/bin/conky/getif.sh} 50,185 bfbfbf c0c0c0 125829120 -t}
]]
diff --git a/.local/bin/conky/getif.sh b/.local/bin/conky/getif.sh
new file mode 100755
index 0000000..78a02ef
--- /dev/null
+++ b/.local/bin/conky/getif.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+os=$(cat "/tmp/os")
+
+# ifconfig | command grep '^[a-z]' | awk '{print $1}' | sed '{/lo/d;s/://;}'
+
+case $os in
+ 1)
+ if_main="eth1"
+ if_alt="eth0"
+ ;;
+ 2)
+ if_main="enx4ce1734c425a"
+ if_alt="wlp1s0"
+ ;;
+ 3)
+ if_main="em0"
+ if_alt="wlan0"
+ exit
+ ;;
+esac
+
+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
+ if_main=$if_alt
+else
+ echo '${font1}NETWORK ${hr}${font}
+${color #928374}No network${font}'
+ exit
+fi
+
+echo -n $if_main
diff --git a/.local/bin/conky/net.sh b/.local/bin/conky/net.sh
index fe14a5d..b04df5c 100755
--- a/.local/bin/conky/net.sh
+++ b/.local/bin/conky/net.sh
@@ -36,7 +36,6 @@ ${color #928374}DNS IP: ${font2}${color #ebdbb2}${nameserver 0}${font}
${color #928374}WAN IP: ${color #ebdbb2}${font2}${execi 300 curl -s https://ifconfig.me || echo No WAN}${font}
${color #928374}---------
${color #928374}${font}Down: ${color #ebdbb2}${font2}${downspeed '$if_main'}${goto 195}${color #928374}${font}Up: ${color #ebdbb2}${font2}${upspeed '$if_main'}${font}
-${color #928374}${font}Received: ${color #ebdbb2}${font2}${totaldown '$if_main'}${goto 195}${color #928374}${font}Sent: ${color #ebdbb2}${font2}${totalup '$if_main'}${font}
-${color #ebdbb2}${downspeedgraph '$if_main' 50,185 bfbfbf c0c0c0 125829120 -t}${goto 195}${color #ebdbb2}${upspeedgraph '$if_main' 50,185 bfbfbf c0c0c0 125829120 -t}'
+${color #928374}${font}Received: ${color #ebdbb2}${font2}${totaldown '$if_main'}${goto 195}${color #928374}${font}Sent: ${color #ebdbb2}${font2}${totalup '$if_main'}${font}'
# ${color #928374}VPN IP: ${font2}${color #ebdbb2}${addr proton0}${font}