From a5f6b8fb3e5fc68c0c9f28998b14c62138316e0c Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Tue, 15 Feb 2022 18:18:29 +0100 Subject: [PATCH] Rename TIME to THRESHOLD, it's a percentage --- dotfiles/i3/blocks | 2 +- dotfiles/i3/scripts/battery | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dotfiles/i3/blocks b/dotfiles/i3/blocks index 9a40b26..029ee7e 100644 --- a/dotfiles/i3/blocks +++ b/dotfiles/i3/blocks @@ -79,7 +79,7 @@ interval=900 interval=5 [battery] -TIME=10 +THRESHOLD=10 interval=5 [calendar] diff --git a/dotfiles/i3/scripts/battery b/dotfiles/i3/scripts/battery index 3a37d31..6583423 100755 --- a/dotfiles/i3/scripts/battery +++ b/dotfiles/i3/scripts/battery @@ -4,7 +4,7 @@ icon="" percent="$(upower -d | grep 'percentage' | awk '{print $2}' | head -n 1)" remaining="$(upower -d | grep 'time to empty' | awk -F: '{print $2}' | awk '{print $1,$2}' | head -n 1)" -if [ -n "$remaining" ] && [ "$(echo "$percent" | awk -F% '{print $1}')" -lt "$TIME" ]; then +if [ -n "$remaining" ] && [ "$(echo "$percent" | awk -F% '{print $1}')" -lt "$THRESHOLD" ]; then notify-send "CHARGE BATTERY" for file in /dev/pts/*; do if [ "$(ls -l "$file" | awk '{print $5}')" = '136,' ]; then