pdate battery-notify.sh
This commit is contained in:
parent
b4aecb0cee
commit
0a836efaba
@ -9,11 +9,7 @@ if [[ "$(uname)" = 'Linux' ]]; then
|
|||||||
|
|
||||||
function is_adapted_connected {
|
function is_adapted_connected {
|
||||||
let connected="$(cat /sys/class/power_supply/ADP1/online)"
|
let connected="$(cat /sys/class/power_supply/ADP1/online)"
|
||||||
if ((${connected} == 1)); then
|
((${connected} == 1))
|
||||||
echo true
|
|
||||||
else
|
|
||||||
echo false
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
# Linux ends here
|
# Linux ends here
|
||||||
else
|
else
|
||||||
@ -29,7 +25,7 @@ local did_notify=false
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
let battery_percent="$(get_battery_percent)"
|
let battery_percent="$(get_battery_percent)"
|
||||||
if ((${battery_percent} > 10)) || "$(is_adapted_connected)"; then
|
if ((${battery_percent} > 10)) || is_adapted_connected; then
|
||||||
did_notify=false
|
did_notify=false
|
||||||
elif ! ${did_notify}; then
|
elif ! ${did_notify}; then
|
||||||
did_notify=true
|
did_notify=true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user