battery script: notify on open pts
This commit is contained in:
parent
01f7ae1d2a
commit
b25b0faad1
1 changed files with 6 additions and 1 deletions
|
@ -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)"
|
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
|
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
|
fi
|
||||||
|
|
||||||
echo "${icon} ${percent} (${remaining})"
|
echo "${icon} ${percent} (${remaining})"
|
||||||
|
|
Loading…
Add table
Reference in a new issue