Suggestions for a lightweight “low-battery warning” monitor

Forum Forums New users New Users and General Questions Suggestions for a lightweight “low-battery warning” monitor

  • This topic has 4 replies, 4 voices, and was last updated Feb 4-8:09 am by Koo.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #51417
    Member
    blur13blur13

    Hi!

    I’m looking for a lightweight “low-battery warning” monitor, something that pops up with a window and maybe a sound when the battery reaches a certain level, say 10%. Just found out the hard way that antiX simply keeps the computer running till the battery dies. I’m thinking of using xfce-power-manager but I’m curios how the antiX crowd have solved this issue. Any suggestions?

    #51424
    Forum Admin
    DaveDave

    There are several ways already posted in the forum/the old forum archive. There is a search function for the forum and the old forum archive under the “forum” menu. Ways include xfce4-power-manager, batti, conky, battery tray icon, xbattbar, etc

    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

    #51426
    Moderator
    AvatarBobC

    I think I have something… Will find and post it. The laptop with the bad battery finally died, so I haven’t been running it.

    #51466
    Moderator
    AvatarBobC

    In my conky I check if the battery is in distress, and if it is I run a script called lowbattery which plays an error sound (included in the zip) and pops up an error msg box which gives the option to continue or shutdown. On mine it would hit 33% and it would die a few minutes after that, because the next number would be 25%, etc. You could change the 33 percent limit to whatever works on your machine to give you enough time to shutdown gracefully.

    You will need to add the battery code below to your ~/.conkyrc and make lowbattery executable somewhere on your path for it to work. There are other things in the zip file related, but those are what’s needed for a low battery alarm.

    ${color2}Batt: ${color}${battery_short BAT0}-${battery_percent BAT0}\
    ${if_match "${battery_short BAT0}" >= "D"}${if_match "${battery_short BAT0}" < "E"}${if_match ${battery_percent BAT0} <= 33}\
    ${if_match ${battery_percent BAT0} >= 1}${execi 10 lowbattery}${endif}${endif}${endif}${endif}

    lowbattery script

    #!/bin/bash
    
    # lowbattery - sends noisy error if battery low with option to shut down
    
    # Idea (probably code too) came from Dave at antix - BobC - bcurrey99 at yahoo.com
    
    play /usr/share/sounds/error.wav
    play /usr/share/sounds/error.wav
    play /usr/share/sounds/error.wav
    
    MESSAGE="The System Battery is Extremely low! Shut Down Now?"
    TITLE="BATTERY EXTREMELY LOW!"
    
    FLAG_FILE="/tmp/batterylow"
    
    if [ ! -f $FLAG_FILE ]; then
    	touch $FLAG_FILE
    	yad --image='error' --text="$MESSAGE" #--button='ok:0' --button='cancel:1'
    	case $? in
                0)    rm $FLAG_FILE && desktop-session -s    ;;
                1)    rm $FLAG_FILE && exit                  ;;
                *)    echo "Not an option" && exit                ;;
    	esac
    fi
    
    • This reply was modified 2 months, 1 week ago by BobC.
    Attachments:
    #51467
    Member
    KooKoo

    I use this just edit the battery percentage you want the warning to start.
    https://github.com/rjekker/i3-battery-popup

    T430 i7-3632QM 16gb , antiX-19.2.1-runit_x64-base Hannie Schaft 29 March 2020 , 5.8.16-antix.1-amd64-smp

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.