dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 87bade5dfbcef2f88bc258331eaf2907e5c0894e
parent e56a849d8cf9d0ee19df3eac191ad80c55e7da90
Author: Alex Balgavy <alexander.balgavy@spaceapplications.com>
Date:   Fri,  1 Aug 2025 15:45:46 +0200

dwmblock-battery: add remaining time

Diffstat:
Mscripts/dwmblock-battery | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/scripts/dwmblock-battery b/scripts/dwmblock-battery @@ -13,8 +13,17 @@ status="$(battery | tac | tr -d '\n' | sed ' s/Unknown/‽‽/' \ | tac | tr -d '\n')" +if command -v upower >/dev/null 2>&1; then + time_remaining=" ($(upower -i /org/freedesktop/UPower/devices/battery_BAT0 \ + | awk -F': ' ' + /^ *time to / { + sub("^ *", "", $2); + sub(" minutes", "min", $2); + print $2 + }'))" +fi case "$status" in ‼*) notify "Battery low" "$status%" battery critical;; ✅*) notify "Battery charged" "$status%" battery;; esac -printf "%s%%\n" "$status" +printf "%s%%%s\n" "$status" "${time_remaining:-}"