From d24f56519425c3dd4a4e016002f9305957895afb Mon Sep 17 00:00:00 2001 From: doc Date: Sun, 27 Jul 2025 21:40:33 +0000 Subject: second commit --- lemonstart.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 lemonstart.sh (limited to 'lemonstart.sh') diff --git a/lemonstart.sh b/lemonstart.sh new file mode 100755 index 0000000..850cb8e --- /dev/null +++ b/lemonstart.sh @@ -0,0 +1,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" -- cgit v1.2.3