commit 4b821d8ed0ffbc03ab162f361a968e4527aaa7dd
parent 88de552e9446837bf06f00f185585d1ccaff0789
Author: awy <awy@awy.one>
Date: Sat, 24 May 2025 20:08:52 +0300
modules
Diffstat:
3 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast
@@ -37,7 +37,7 @@ readfile() { weatherdata="$(cat "$weatherreport")" ;}
showweather() {
readfile
# shellcheck disable=SC2046,SC2183
- printf "ā%s š„¶%s° š%s°\n" "$(getprecipchance)" $(getdailyhighlow)
+ printf "ļ© %s ļ %s° ļ
%s°\n" "$(getprecipchance)" $(getdailyhighlow)
}
case $1 in
diff --git a/.local/bin/statusbar/sb-memory b/.local/bin/statusbar/sb-memory
@@ -1,12 +1,12 @@
#!/bin/sh
case $1 in
- 1) notify-send "š§ Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
- 2) setsid -f "$TERMINAL" -e htop ;;
- 3) notify-send "š§ Memory module" "\- Shows Memory Used/Total.
+ 1) notify-send "š§ Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
+ 2) setsid -f "$TERMINAL" -e btop ;;
+ 3) notify-send "š§ Memory module" "\- Shows Memory Used/Total.
- Click to show memory hogs.
- Middle click to open htop." ;;
- 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
+ 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
-free --mebi | sed -n '2{p;q}' | awk '{printf ("š§ %sMB\n", ($3))}'
+free --mebi | awk '/Mem:/ { printf("ļø %.0f%%\n", $3/$2 * 100) }'
diff --git a/.local/bin/statusbar/sb-nettraf b/.local/bin/statusbar/sb-nettraf
@@ -1,29 +1,32 @@
#!/bin/sh
-# Module showing network traffic. Shows how much data has been received (RX) or
-# transmitted (TX) since the previous time this script ran. So if run every
-# second, gives network traffic per second.
+# Show per-second network traffic using consistent-width output
case $1 in
- 1) setsid -f "$TERMINAL" -e sudo -A bandwhich ;;
- 3) notify-send "š Network traffic module" "š»: Traffic received
+ 1) setsid -f "$TERMINAL" -e sudo -A bandwhich ;;
+ 3) notify-send "š Network traffic module" "š»: Traffic received
šŗ: Traffic transmitted" ;;
- 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
+ 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
update() {
- sum=0
- for arg; do
- read -r i < "$arg"
- sum=$(( sum + i ))
- done
- cache=/tmp/${1##*/}
- [ -f "$cache" ] && read -r old < "$cache" || old=0
- printf %d\\n "$sum" > "$cache"
- printf %d\\n $(( sum - old ))
+ sum=0
+ for arg; do
+ read -r i < "$arg"
+ sum=$(( sum + i ))
+ done
+ cache=/tmp/${1##*/}
+ [ -f "$cache" ] && read -r old < "$cache" || old=0
+ printf %d\\n "$sum" > "$cache"
+ printf %d\\n $(( sum - old ))
}
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
-printf "š»%4sB šŗ%4sB\\n" $(numfmt --to=iec $rx $tx)
+# Format bytes to IEC, strip spaces
+rx_fmt=$(numfmt --to=iec --padding=4 $rx)
+tx_fmt=$(numfmt --to=iec --padding=4 $tx)
+
+# Ensure consistent width with %-6s (6-character padded fields)
+printf "ļ£ %-6s ļ¢ %-6s\n" "$rx_fmt" "$tx_fmt"