From 82f4d2368a90d8b271fdafc0a3ccc9dc078c4e7d Mon Sep 17 00:00:00 2001 From: u Date: Sun, 9 Apr 2023 10:35:42 -0400 Subject: show charging status in tty output --- go.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/go.sh b/go.sh index 686127f..d68c002 100755 --- a/go.sh +++ b/go.sh @@ -27,14 +27,14 @@ go() return 1 ;; esac + read status < "$status_file" || return + if [ -t 2 ] then - printf ' %.2d%% \r' "$capacity" >&2 + printf '\r %20s %.2d%%\r' "$status" "$capacity" >&2 fi - read status < "$status_file" || return [ "$status" = Discharging ] || return 0 - if [ "$capacity" -lt "$capacity_threshold" ] then systemctl suspend -- cgit v1.2.3