Modify i3blocks battery: clean shutdown and don't write to /dev/pts/*

This commit is contained in:
flyingscorpio@clevo 2023-01-20 08:27:40 +01:00
parent 0b53b029a1
commit 20d8eb5c15

View file

@ -26,14 +26,11 @@ elif upower -d | grep -E 'state.+\bdischarging\b' >/dev/null 2>&1; then
elif [ "$percent" -lt 90 ]; then
icon="${LABEL_90}"
fi
if [ "$percent" -lt "$THRESHOLD" ]; then
if [ "$percent" -lt 3 ]; then
shutdown now
elif [ "$percent" -lt "$THRESHOLD" ]; then
icon="${LABEL_ALERT}"
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})"
else