Introduced variable for interface for easy changing

This commit is contained in:
_N0x 2021-10-17 16:46:26 +02:00
parent ddf61b3bc4
commit 8f5803974e

View File

@ -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