add upload and download speed modules

This commit is contained in:
Emily Daemon 2022-04-09 18:25:55 +03:00
parent edb35d72c2
commit ea722302ac
2 changed files with 16 additions and 0 deletions

View File

@ -20,4 +20,6 @@
#module_cpu "CPU: " " | " #module_cpu "CPU: " " | "
#module_battery "Battery: " " | " #module_battery "Battery: " " | "
#module_todo "TODO: " " | " #module_todo "TODO: " " | "
#module_upload "Up: " " | "
#module_download "Down: " " | "
module_date "Date: " "" module_date "Date: " ""

View File

@ -59,3 +59,17 @@ module_todo() {
todooutput="$(head -n 1 ~/.todo.txt)" todooutput="$(head -n 1 ~/.todo.txt)"
[ "$todooutput" = "" ] || export bar="${bar}${1}${todooutput}${2}" [ "$todooutput" = "" ] || export bar="${bar}${1}${todooutput}${2}"
} }
export netdevice=""
module_upload() {
# https://github.com/speediegamer/xshbar-plugins/blob/main/netstat.plugin
up="$(cat /sys/class/net/${netdevice}/statistics/rx_bytes | awk '{$1=$1/1024000; print $1"B";}' | tail -n 1)"
export bar="${bar}${1}${up}${2}"
}
module_download() {
# https://github.com/speediegamer/xshbar-plugins/blob/main/netstat.plugin
down="$(cat /sys/class/net/${netdevice}/statistics/tx_bytes | awk '{$1=$1/1024000; print $1"B";}' | tail -n 1)"
export bar="${bar}${1}${down}${2}"
}