Introduced variable for interface for easy changing
This commit is contained in:
parent
ddf61b3bc4
commit
8f5803974e
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
interval=0
|
interval=0
|
||||||
|
interface="wlo1"
|
||||||
|
|
||||||
datetime() {
|
datetime() {
|
||||||
icon=""
|
icon=""
|
||||||
@ -40,14 +41,13 @@ disk() {
|
|||||||
|
|
||||||
networkspeed() {
|
networkspeed() {
|
||||||
icon="龍"
|
icon="龍"
|
||||||
iface="enp4s0"
|
|
||||||
up=""
|
up=""
|
||||||
down=""
|
down=""
|
||||||
R1="$(cat /sys/class/net/$iface/statistics/rx_bytes)"
|
R1="$(cat /sys/class/net/$interface/statistics/rx_bytes)"
|
||||||
T1="$(cat /sys/class/net/$iface/statistics/tx_bytes)"
|
T1="$(cat /sys/class/net/$interface/statistics/tx_bytes)"
|
||||||
sleep 1
|
sleep 1
|
||||||
R2="$(cat /sys/class/net/$iface/statistics/rx_bytes)"
|
R2="$(cat /sys/class/net/$interface/statistics/rx_bytes)"
|
||||||
T2="$(cat /sys/class/net/$iface/statistics/tx_bytes)"
|
T2="$(cat /sys/class/net/$interface/statistics/tx_bytes)"
|
||||||
TBPS="$(expr $T2 - $T1)"
|
TBPS="$(expr $T2 - $T1)"
|
||||||
RBPS="$(expr $R2 - $R1)"
|
RBPS="$(expr $R2 - $R1)"
|
||||||
TKBPS="$(expr $TBPS / 1024)"
|
TKBPS="$(expr $TBPS / 1024)"
|
||||||
@ -57,9 +57,8 @@ networkspeed() {
|
|||||||
|
|
||||||
networkinfo() {
|
networkinfo() {
|
||||||
icon=""
|
icon=""
|
||||||
iface="enp4s0"
|
IPADDR="$(ip a show dev $interface | awk '/inet / { print $2 } ')"
|
||||||
IPADDR="$(ip a show dev $iface | awk '/inet / { print $2 } ')"
|
printf "^b#408977^^c#eeeeee^ %s ^d^ %s [%s]" "$icon" "$interface" "$IPADDR"
|
||||||
printf "^b#408977^^c#eeeeee^ %s ^d^ %s [%s]" "$icon" "$iface" "$IPADDR"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
song() {
|
song() {
|
||||||
@ -70,7 +69,7 @@ song() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
xsetroot -name " $(cpu) $(memory) $(networkspeed) $(networkinfo) $(disk) $(song) $(datetime) "
|
xsetroot -name " $(cpu) $(memory) $(networkinfo) $(disk) $(battery) $(datetime) "
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user