From b25b0faad1fba1a56173289603d246939fce7322 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Mon, 14 Feb 2022 15:02:46 +0100 Subject: [PATCH] battery script: notify on open pts --- dotfiles/i3/scripts/battery | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dotfiles/i3/scripts/battery b/dotfiles/i3/scripts/battery index a1c5f89..d43790a 100755 --- a/dotfiles/i3/scripts/battery +++ b/dotfiles/i3/scripts/battery @@ -5,7 +5,12 @@ 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 5 ]; then - notify-send "CHARGE YOUR BATTERY" + notify-send "CHARGE BATTERY" + for file in /dev/pts/*; do + if [ "$(ls -l "$file" | awk '{print $5}')" = '136,' ]; then + echo "CHARGE BATTERY" >> "$file" + fi + done fi echo "${icon} ${percent} (${remaining})"