summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoru <u@billy>2023-04-09 10:35:42 -0400
committeru <u@billy>2023-04-09 10:35:42 -0400
commit82f4d2368a90d8b271fdafc0a3ccc9dc078c4e7d (patch)
treee5ce52361dd1e1e584a023de8f7a85a99f22805c
parentd03defeecd0377373ad5c6d8efe0ff8b6aa844ee (diff)
show charging status in tty output
-rwxr-xr-xgo.sh6
1 files 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()
27 return 1 ;; 27 return 1 ;;
28 esac 28 esac
29 29
30 read status < "$status_file" || return
31
30 if [ -t 2 ] 32 if [ -t 2 ]
31 then 33 then
32 printf ' %.2d%% \r' "$capacity" >&2 34 printf '\r %20s %.2d%%\r' "$status" "$capacity" >&2
33 fi 35 fi
34 36
35 read status < "$status_file" || return
36 [ "$status" = Discharging ] || return 0 37 [ "$status" = Discharging ] || return 0
37
38 if [ "$capacity" -lt "$capacity_threshold" ] 38 if [ "$capacity" -lt "$capacity_threshold" ]
39 then 39 then
40 systemctl suspend 40 systemctl suspend