From 24b4c9e6c2cf25215c4d30e422aefdb52b968ffd Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Mon, 27 Sep 2021 14:17:26 +0300 Subject: [PATCH] Fix time in battery script --- profiles/workspace/i3blocks/scripts/battery.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/profiles/workspace/i3blocks/scripts/battery.nix b/profiles/workspace/i3blocks/scripts/battery.nix index b827b85..8067e7b 100644 --- a/profiles/workspace/i3blocks/scripts/battery.nix +++ b/profiles/workspace/i3blocks/scripts/battery.nix @@ -9,9 +9,9 @@ INFO="$(${upower}/bin/upower -i "$dev")" PERCENTAGE="$(echo "$INFO" | grep 'percentage:' | grep -o '[[:digit:]]*')" if [ -n "$PERCENTAGE" ]; then + TIME="$(echo "$INFO" | grep 'time to' | tr -s ' ' | cut -d' ' -f5-6)" STATE="$(echo "$INFO" | grep 'state:' | tr -s ' ' | cut -d' ' -f3)" if [[ "x$STATE" == "xfully-charged" ]] || [[ "x$STATE" == "xcharging" ]]; then - TIME="$(echo "$INFO" | grep 'time to empty:' | tr -s ' ' | cut -d' ' -f5-6)" case $PERCENTAGE in [2-3]*) icon=;; [4-5]*) icon=;; @@ -24,7 +24,6 @@ if [[ "$PERCENTAGE" -lt ${toString low_threshold} ]]; then STATUS=33 fi - TIME="$(echo "$INFO" | grep 'time to full:' | tr -s ' ' | cut -d' ' -f5-6)" case $PERCENTAGE in 1?) icon=;; 2?) icon=;;