Re: [dev] dwm battery level alarm system

From: Danilo Bargen <gezuru_AT_gmail.com>
Date: Thu, 27 Jan 2011 01:55:24 +0100

This solution seems to work great (part of my .xinitrc):

    while true; do
            # Set root title
            sh $HOMEDIR/.xsetroot

            # Check battery level
            BATT=$( acpi -b | sed 's/.*[charging|unknown],
\([0-9]*\)%.*/\1/gi' )
            if [ $BATT -le 5 ]; then
                # Beep
                echo -e "\007" >/dev/tty10 && sleep 0.2
                echo -e "\007" >/dev/tty10 && sleep 0.2
                echo -e "\007" >/dev/tty10 && sleep 0.2
                # Blink
                echo 'on' > /proc/acpi/ibm/light && sleep 1
                echo 'off' > /proc/acpi/ibm/light
            fi

            # Update every 30s
            sleep 30s
    done &

It beeps 3 times and flashes the ThinkLight every 30s, in case the
battery level is below 5%.

--Danilo
Received on Thu Jan 27 2011 - 01:55:24 CET

This archive was generated by hypermail 2.2.0 : Thu Jan 27 2011 - 02:00:07 CET