Modify i3blocks battery: clean shutdown and don't write to /dev/pts/*
This commit is contained in:
parent
0b53b029a1
commit
20d8eb5c15
1 changed files with 3 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue