diff --git a/batAlarm.sh b/batAlarm.sh index 46995aa..9796347 100755 --- a/batAlarm.sh +++ b/batAlarm.sh @@ -5,28 +5,23 @@ # Iris Lightshard # MIT License -flag1=0 -flag2=0 +warn=30 +crit=20 +dismissed=0 while true; do charge=$(cat /sys/class/power_supply/BAT0/capacity) - if [ $charge -lt 11 ]; then - if [ $flag1 -eq 0 ]; then - flag1=1 - notify-send -t 10000 battery [${charge}%] - fi - elif [ $charge -lt 21 ]; then - if [ $flag2 -eq 0 ]; then - flag2=1 - notify-send -t 10000 battery [${charge}%] + if [ $charge -lt $(($crit + 1)) ]; then + notify-send -c power -t 100000 battery [${charge}%] + elif [ $charge -lt $(($warn + 1)) ]; then + if [ $dismissed -eq 0 ]; then + dismissed=1 + notify-send -c power -t 1000000 battery [${charge}%] fi fi - if [ $charge -gt 20 ]; then - flag2=0 - fi - if [ $charge -gt 10 ]; then - flag1=0 + if [ $charge -gt $warn ]; then + dismissed=0 fi sleep 60 diff --git a/rezonate.sh b/rezonate.sh new file mode 100755 index 0000000..bcff9f4 --- /dev/null +++ b/rezonate.sh @@ -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