From 8f5803974e3905a03853728093f08239008b21ac Mon Sep 17 00:00:00 2001 From: _N0x Date: Sun, 17 Oct 2021 16:46:26 +0200 Subject: [PATCH] Introduced variable for interface for easy changing --- localbin/.local/bin/statusbar | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/localbin/.local/bin/statusbar b/localbin/.local/bin/statusbar index a29cc7e..50e452d 100755 --- a/localbin/.local/bin/statusbar +++ b/localbin/.local/bin/statusbar @@ -1,6 +1,7 @@ #!/bin/bash interval=0 +interface="wlo1" datetime() { icon="" @@ -40,14 +41,13 @@ disk() { networkspeed() { icon="龍" - iface="enp4s0" up="" down="" - R1="$(cat /sys/class/net/$iface/statistics/rx_bytes)" - T1="$(cat /sys/class/net/$iface/statistics/tx_bytes)" + R1="$(cat /sys/class/net/$interface/statistics/rx_bytes)" + T1="$(cat /sys/class/net/$interface/statistics/tx_bytes)" sleep 1 - R2="$(cat /sys/class/net/$iface/statistics/rx_bytes)" - T2="$(cat /sys/class/net/$iface/statistics/tx_bytes)" + R2="$(cat /sys/class/net/$interface/statistics/rx_bytes)" + T2="$(cat /sys/class/net/$interface/statistics/tx_bytes)" TBPS="$(expr $T2 - $T1)" RBPS="$(expr $R2 - $R1)" TKBPS="$(expr $TBPS / 1024)" @@ -57,9 +57,8 @@ networkspeed() { networkinfo() { icon="" - iface="enp4s0" - IPADDR="$(ip a show dev $iface | awk '/inet / { print $2 } ')" - printf "^b#408977^^c#eeeeee^ %s ^d^ %s [%s]" "$icon" "$iface" "$IPADDR" + IPADDR="$(ip a show dev $interface | awk '/inet / { print $2 } ')" + printf "^b#408977^^c#eeeeee^ %s ^d^ %s [%s]" "$icon" "$interface" "$IPADDR" } song() { @@ -70,7 +69,7 @@ song() { } while true; do - xsetroot -name " $(cpu) $(memory) $(networkspeed) $(networkinfo) $(disk) $(song) $(datetime) " + xsetroot -name " $(cpu) $(memory) $(networkinfo) $(disk) $(battery) $(datetime) " sleep 5 done