Low-batt notification for Puppy? (Solved)

Using applications, configuring, problems
Message
Author
muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#31 Post by muggins »

I recently changed my pupversion & liked everything except the included powerapplet_tray, which didn'r seem to reflect my laptop's real battery state.

So i'm happy I came across sfs's link for cbatticon, which is easy to compile, accurately reflects battery state, and with which you can have a script in /root/Startup with something like:

Code: Select all

cbatticon -l 10 -r 5 -c wmpoweroff
where it will warn you when percentage gets to 10, then poweroff at 5%.
Last edited by muggins on Sat 10 Feb 2018, 21:35, edited 1 time in total.

User avatar
festus
Posts: 235
Joined: Wed 14 Jan 2015, 19:10

#32 Post by festus »

muggins wrote:I recently changed my pupversion & liked everything except the included powerapplet_tray, which didn'r seem to reflect my laptop's real battery state.

So i'm happy I came across sfs's link for cbatticon, which is easy to compile, accurately reflects battery state, and with which you can have a script in /root/Startup with something like:

Code: Select all

cbatticon -l 10 -r 5 -c wmrpoweroff
where it will warn you when percentage gets to 10, then poweroff at 5%.
Hello, muggins, I am interested in this battery app, but can not compile it, as I have always compiled sources starting with - "./configure --prefix=/usr"
and it did not work with this cbatticon source.

Would you, please, post your comp. recipe for this app.?

btw, I'm using xenial-7.5 & slacko-6999, if that matters any.

Thank you

bliss,
festus

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#33 Post by muggins »

Hello Festus,

I just ran the included makefile & it generated a 31k binary. You can than
just copy the binary to /usr/bin.

matchpoint
Posts: 168
Joined: Fri 26 Jan 2018, 20:54

#34 Post by matchpoint »

Hello festus, run the build like this: make WITH_GTK3=0

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#35 Post by muggins »

Thanks Matchpoint,

I forgot you can compile it for gtk3 or gtk2. I just changed line 7, of the makefile, to "WITH_GTK3 = 0".

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#36 Post by muggins »

OK,

here's a pet attached for anyone that wants to try it. I don't know that it will work in every pupversion, but it should in most.

Run

Code: Select all

cbatticon -h
to see usage options. Or open, in a text editor, the script /root/Startup/cbatt and modify it to suit your laptop/preferences. At the moment it has:

Code: Select all

#!/bin/sh

cbatticon -l 5 -r 3 -c wmreboot
So is set to reboot when battery level gets to 3%.
Attachments
CBattIcon-1.6.7.pet
(19.1 KiB) Downloaded 171 times

User avatar
festus
Posts: 235
Joined: Wed 14 Jan 2015, 19:10

#37 Post by festus »

Thanks for the help, muggins & matchpoint.

I should have realized running "make" would work since it already contained the Makefile.

I am testing it on slacko-6999(32 bit), using "WITH_GTK3 = 1", since I installed gtk3 in this pup.

@muggins
In your initial post about cbatticon, is thie command correct?:
cbatticon -l 10 -r 5 -c wmrpoweroff
the "wmrpoweroff" in particular?
Is the "r" supposed to be there?

Thanks again,
festus

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#38 Post by bigpup »

I would call that a typo.
Puppy uses

Code: Select all

wmpoweroff
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

User avatar
festus
Posts: 235
Joined: Wed 14 Jan 2015, 19:10

#39 Post by festus »

bigpup wrote:I would call that a typo.
Puppy uses

Code: Select all

wmpoweroff
Thanks, bigpup, for the clarification.

I decided to use the gtk-2 vesion on all my pups, and tested it out on slacko-6999 by letting the battery run down past my critical setting of 5%, and it did indeed poweroff the laptop, as desired.

Thanks to all,
festus

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#40 Post by muggins »

Yes,

a typo as bigpup said. Corrected initial post. Thanks.

User avatar
Subito Piano
Posts: 731
Joined: Mon 28 May 2007, 03:12
Location: UPSTATE New York
Contact:

#41 Post by Subito Piano »

Thanks, muggins! For some reason my home laptop makes a LOT of noise to warn of a low battery (a BIOS feature) but my work laptop doesn't. You solution is nice and small -- and an easily-installed pet.

Just in case somebody else needs an audible warning, my one tweak (after installation) -- in case I'm not in front of my laptop when the battery gets low -- was to add an alarm. I found a nice WAV file of a siren ("siren.wav" - it has to be a WAV file for some reason), put it in /usr/audio, and edited the cbatt file in ~/Startup to read so:

Code: Select all

#!/bin/sh

cbatticon -l 5 -r 3 -c "aplay /usr/share/audio/siren.wav wmreboot"
Now it warns me visually at around 5%, then again at 3%, then soon I am audibly warned of an impending nuclear meltdown! Nice and annoying -- it grabs my attention. Image
[color=green]"God is love" - [url=https://www.esv.org/1+John+4/]I John 4:12[/url][/color]
ðŸ￾§ ðŸ￾§ ðŸ￾§ Rockin' on a 2007 IBM/Lenovo T60 Centrino Duo with 32-bit XenialPup 7.5! :D
(A/V Linux for live digital synth needs)

Post Reply