blob: 850cb8e04de4e2a80ad08cc97db4a3c49b6be0c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/bin/bash
NETIF="enp0s31f6" # <-- Replace with your real interface name if different
POOL_NAME="gigapool"
get_net_speed() {
if [[ ! -f /sys/class/net/$NETIF/statistics/rx_bytes ]]; then
echo "🌐 No iface"
return
fi
R1=$(cat /sys/class/net/$NETIF/statistics/rx_bytes)
T1=$(cat /sys/class/net/$NETIF/statistics/tx_bytes)
sleep 1
R2=$(cat /sys/class/net/$NETIF/statistics/rx_bytes)
T2=$(cat /sys/class/net/$NETIF/statistics/tx_bytes)
RXBPS=$(( (R2 - R1) / 1024 ))
TXBPS=$(( (T2 - T1) / 1024 ))
echo "↓ ${RXBPS}KB/s ↑ ${TXBPS}KB/s"
}
get_zpool_status() {
if sudo zpool list "$POOL_NAME" &>/dev/null; then
HEALTH=$(sudo zpool get -H -o value health "$POOL_NAME" 2>/dev/null)
FREE=$(sudo zpool list -H -o free "$POOL_NAME" 2>/dev/null)
echo "$POOL_NAME: $HEALTH ($FREE free)"
else
echo "$POOL_NAME: Not Imported"
fi
}
get_volume() {
pamixer --get-volume 2>/dev/null || echo "NoVol"
}
while true; do
TIME=$(date '+%H:%M:%S')
UPTIME=$(uptime -p | sed 's/up //')
VOLUME=$(get_volume)
NET=$(get_net_speed)
echo "%{l}💾 $ZPOOL %{c}🌐 $NET %{r}🔊 ${VOLUME}% 🕒 $TIME ⏳ $UPTIME"
done | lemonbar -g x24 -B "#1e1e1e" -F "#00ff00" -p -f "NotoSansMono-Regular"
|