aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/sb-nettraf
diff options
context:
space:
mode:
authorawy <awy@awy.one>2024-11-30 16:19:05 +0300
committerawy <awy@awy.one>2024-11-30 16:19:05 +0300
commit18497419838d63c09fa86ed2217b94b7a2b2b32a (patch)
treeac962e680ffa19cab329edf33d6a3ba256d3437f /.local/bin/statusbar/sb-nettraf
parent04a706bf3c225fccd11cc3821f36ffed5a30cf65 (diff)
icons
Diffstat (limited to '.local/bin/statusbar/sb-nettraf')
-rwxr-xr-x.local/bin/statusbar/sb-nettraf22
1 files changed, 11 insertions, 11 deletions
diff --git a/.local/bin/statusbar/sb-nettraf b/.local/bin/statusbar/sb-nettraf
index 2f223d6..ce001b0 100755
--- a/.local/bin/statusbar/sb-nettraf
+++ b/.local/bin/statusbar/sb-nettraf
@@ -6,21 +6,21 @@
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e bmon ;;
- 3) notify-send "🌐 Network traffic module" "🔻: Traffic received
-🔺: Traffic transmitted" ;;
+ 3) notify-send "  Network traffic module" "  : Traffic received
+  : Traffic transmitted" ;;
8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
update() {
- sum=0
- for arg; do
- read -r i < "$arg"
- sum=$(( sum + i ))
- done
- cache=/tmp/${1##*/}
- [ -f "$cache" ] && read -r old < "$cache" || old=0
- printf %d\\n "$sum" > "$cache"
- printf %d\\n $(( sum - old ))
+ sum=0
+ for arg; do
+ read -r i < "$arg"
+ sum=$(( sum + i ))
+ done
+ cache=/tmp/${1##*/}
+ [ -f "$cache" ] && read -r old < "$cache" || old=0
+ printf %d\\n "$sum" > "$cache"
+ printf %d\\n $(( sum - old ))
}
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)