update batAlarm and add rezonate

This commit is contained in:
Iris Lightshard 2024-10-17 10:03:04 -06:00
parent b3bdb1f602
commit 8e84fdb917
Signed by: Iris Lightshard
GPG key ID: 688407174966CAF3
2 changed files with 39 additions and 16 deletions

View file

@ -5,28 +5,23 @@
# Iris Lightshard <nilix@nilfm.cc> # Iris Lightshard <nilix@nilfm.cc>
# MIT License # MIT License
flag1=0 warn=30
flag2=0 crit=20
dismissed=0
while true; do while true; do
charge=$(cat /sys/class/power_supply/BAT0/capacity) charge=$(cat /sys/class/power_supply/BAT0/capacity)
if [ $charge -lt 11 ]; then if [ $charge -lt $(($crit + 1)) ]; then
if [ $flag1 -eq 0 ]; then notify-send -c power -t 100000 battery [${charge}%]
flag1=1 elif [ $charge -lt $(($warn + 1)) ]; then
notify-send -t 10000 battery [${charge}%] if [ $dismissed -eq 0 ]; then
fi dismissed=1
elif [ $charge -lt 21 ]; then notify-send -c power -t 1000000 battery [${charge}%]
if [ $flag2 -eq 0 ]; then
flag2=1
notify-send -t 10000 battery [${charge}%]
fi fi
fi fi
if [ $charge -gt 20 ]; then if [ $charge -gt $warn ]; then
flag2=0 dismissed=0
fi
if [ $charge -gt 10 ]; then
flag1=0
fi fi
sleep 60 sleep 60

28
rezonate.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/sh
urldecode(){
echo "$1" | perl -pe 's/\+/\ /g;' -e 's/%(..)/chr(hex($1))/eg;'
}
if [ -z "$2" ]; then
echo "usage: $0 PLIST DEST"
echo " dumps the local files from the audacious playlist PLIST to the connected android device's filesystem at DEST"
exit 1
fi
plist=$1
dest=$2
if [ ! -f "${plist}" ]; then
echo "playlist doesn't exist!"
exit 2
fi
if ! adb shell "test -d ${dest}"; then
echo "dest doesn't exist or the device isn't properly connected!"
exit 3
fi
for f in $(grep ^uri= $1 | awk -Ffile:// '{print $2}'); do
adb push "$(urldecode $f)" $2
done