@@ -764,17 +824,30 @@ do
touch /tmp/snapmergepuppyrequest #request to savepuppy_func.
SAVECNT=0
fi
- if [ $POWERTIMEOUT -ne 0 ];then #w007 power-off computer after inactivity.
+ MINUTECNT=$((MINUTECNT+4))
+ if [ $MINUTECNT -gt 59 ];then #come in here every minute...
+ MINUTECNT=0;echo "Next Minute"
+ if [ "$BAT_0" = '1' ];then echo "BAT_0 detected"
+ BAT_0_CURRENT=`grep 'remaining capacity:' "$BAT_0_state_file"`
+ BAT_0_CURRENT="${BAT_0_CURRENT//[^[:digit:]]/}"
+ echo "BAT_0_CURRENT='$BAT_0_CURRENT'"
+ if [ $BAT_0_CURRENT -lt $BAT_0_WARN ];then
+ aplay /usr/share/audio/2barks.au;aplay /usr/share/audio/2barks.au
+ pupmessage -bg red -timeout 30 "Battery State is: $BAT_0_CURRENT
+better to plug in ac adapter or poweroff the laptop "
+ fi #warn
+ fi #bat
+ if [ $POWERTIMEOUT -ne 0 ];then #w007 power-off computer after inactivity.
MOUSECNT=`expr $MOUSECNT + 4`
- MINUTECNT=`expr $MINUTECNT + 4`
- if [ $MINUTECNT -gt 59 ];then #come in here every minute...
- MINUTECNT=0
- CURPOS2="`getcurpos`"
- echo "MOUSECNT=$MOUSECNT CURPOS2=$CURPOS2" >> /tmp/pup_event_frontend_d_curpos.log
- [ "$CURPOS1" = "" ] && CURPOS1="$CURPOS2"
- [ "$CURPOS1" != "$CURPOS2" ] && MOUSECNT=0
- CURPOS1="$CURPOS2"
- [ $MOUSECNT -gt $POWERTIMEOUT ] && wmpoweroff &
+ #MINUTECNT=`expr $MINUTECNT + 4`
+ #if [ $MINUTECNT -gt 59 ];then #come in here every minute...
+ #MINUTECNT=0
+ CURPOS2="`getcurpos`"
+ #echo "MOUSECNT=$MOUSECNT CURPOS2=$CURPOS2" >> /tmp/pup_event_frontend_d_curpos.log
+ [ "$CURPOS1" = "" ] && CURPOS1="$CURPOS2"
+ [ "$CURPOS1" != "$CURPOS2" ] && MOUSECNT=0
+ CURPOS1="$CURPOS2"
+ [ $MOUSECNT -gt $POWERTIMEOUT ] && wmpoweroff &
fi
fi
#some apps should not be disturbed by this background stuff...
NOTE 1:
I have only one netbook, the path to /proc/acpi/battery/BAT0/state might vary. Probably worth a tab in the eventmanager GUI.
NOTE 2:
Tested on two frugal installs and worked ok.
NOTE 3:
Might have too much debugging echo output.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum