#!/bin/sh ################################################## # CUSTOMIZE HERE AS YOU WISH ################################################## power_supply_alert(){ aplay /usr/share/orage/sounds/Spo.wav } ################################################## # YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW HERE ################################################## # battery BATTERY_DEVICE=$(hal-find-by-property --key info.category --string battery | head -n 1) BATTERY_PERCENT=$(hal-get-property --udi ${BATTERY_DEVICE} --key battery.charge_level.percentage) # AC Adapter AC_DEVICE=$(hal-find-by-property --key info.category --string ac_adapter | head -n 1) AC_STATUS=$(hal-get-property --udi ${AC_DEVICE} --key ac_adapter.present | sed -e 's/true/on-line/; s/false/off-line/') if [[ ${BATTERY_PERCENT} -lt 10 ]] && [[ ${AC_STATUS} == 'off-line' ]]; then power_supply_alert fi echo "AC: ${AC_STATUS} BAT: ${BATTERY_PERCENT}%"