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 ex_Koo.
-
AuthorPosts
-
February 3, 2021 at 12:31 pm #51417Member
blur13
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?
February 3, 2021 at 3:31 pm #51424Forum Admin
Dave
::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
February 3, 2021 at 4:56 pm #51426ModeratorBobC
::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.
February 4, 2021 at 7:56 am #51466ModeratorBobC
::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 years, 3 months ago by BobC.
Attachments:
February 4, 2021 at 8:09 am #51467Memberex_Koo
::I use this just edit the battery percentage you want the warning to start.
https://github.com/rjekker/i3-battery-popup -
AuthorPosts
- You must be logged in to reply to this topic.