commit 521f035708543d071503a5f6cdf285c17878d556
parent 06a2ae3422aa7067b8229d56fa7bb0542a960079
Author: Chris Kiriakou <c@ckiri.com>
Date: Wed, 19 Aug 2026 21:29:43 +0200
add new functions, fix format string of printf
Diffstat:
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/scripts/dot-local/bin/batterystate.sh b/scripts/dot-local/bin/batterystate.sh
@@ -10,7 +10,7 @@ main() {
# Send warning if battery is low and no charger is plugged in
test "${bat_perc}" -le 5 && test "${bat_status}" != 'Charging' \
&& notify-send --urgency=ciritcal "Plug in a charger, low battery!"
- printf "${bat_perc}-${bat_status}"
+ printf "%s\n" "${bat_perc}% (${bat_status})"
}
main
diff --git a/scripts/dot-local/bin/status.sh b/scripts/dot-local/bin/status.sh
@@ -3,9 +3,13 @@
# Fetch status information
main() {
- date=$(date +'%a, %d.%m.%Y %H:%M')
- test -d /sys/class/power_supply/BAT0 && bat=$(~/.local/bin/batterystate.sh)
- printf "${bat} ${date}\n"
+ wifi="Wifi: $(nmcli --terse --colors no connection show --active | sed 2d | cut --delimiter ':' --fields=1) | "
+ uptime="$(uptime --pretty) | "
+ disk="Disk: $(df --human-readable / --output=pcent | sed 1d | cut --whitespace-delimited --fields=2) | "
+ ram="RAM: $(free --human --line | cut --whitespace-delimited --fields=4) | "
+ date="$(date +'%a, %d.%m.%Y %H:%M') "
+ test -d /sys/class/power_supply/CMB1 && bat="Bat: $(~/.local/bin/batterystate.sh) | "
+ printf "%s\n" "${uptime}${disk}${ram}${bat}${wifi}${date}"
}
main