Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 19 Jun 2013, 23:31
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
pbatt - Real GTK2 Battery Monitor
Moderators: deshlab, Flash, GuestToo, Ian, JohnMurga, Lobster
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 3 [31 Posts]   Goto page: Previous 1, 2, 3 Next
Author Message
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: Sun 14 Dec 2008, 09:25    Post subject:  

Dougal wrote:
I'm not really fond of these apps that use scripts to get info...
But isn't that the whole point of this app in the generic sense.

It provides an interface to allow a script to control a status icon.

I'm interested in what your objection is providing they are not called too often. Every 30 seconds would be acceptable for a battery monitor.

_________________
Will
contribute: community website, screenshots, puplets, wiki, rss
Back to top
View user's profile Send private message 
brad_chuck

Joined: 15 Aug 2005
Posts: 284
Location: Appalachian Mountains

PostPosted: Sun 14 Dec 2008, 21:34    Post subject:  

The "event" program does not have to be a script. Write it in c... have fun with that.

The idea is that YOU get to make the "event" program do whatever you would like. I like shell scripts.

The script I provided was just an example. Will have to work on a "production" in the next few weeks. Any help here would be great.

HairyWill - Thanks for the icon tip this will help.

Still have to work on a few things. Will have another "preview" out soon.
Back to top
View user's profile Send private message 
Dougal


Joined: 19 Oct 2005
Posts: 2505
Location: Hell more grotesque than any medieval woodcut

PostPosted: Mon 15 Dec 2008, 07:11    Post subject:  

brad_chuck wrote:
The "event" program does not have to be a script. Write it in c... have fun with that.

The idea is that YOU get to make the "event" program do whatever you would like. I like shell scripts.

Yeah, I realized that and I like shell scripts, too.
My point is that if you're already running that applet, you might as well have it do everything, rather that call an external script every two seconds (and you actually call it twice every time, with "-i" and "-t").
I remember in the past, I used to look in top and keep seeing lots of instances of calcfreespace.sh, which was run by the freememapplet. I just ended up using a vfs function to get the free space and got rid of the shell script.

Note that in the case of the battery applet, for example, you're also losing the history, which can be useful: battery applets will usually average the (dis)charging rate to calculate the time left, since the momentary value can fluctuate...

_________________
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind
Back to top
View user's profile Send private message 
Dougal


Joined: 19 Oct 2005
Posts: 2505
Location: Hell more grotesque than any medieval woodcut

PostPosted: Mon 15 Dec 2008, 07:30    Post subject:  

I've made another couple of updates:
0.2: adds checking for info in /sys/class/power_supply.
I hope the rate code is ok, as I'm testing with a bad bios that doesn't supply the rate info.

0.2.1: adds use of the GlossyPower icons linked in the previous page (so it has 10 different battery icons). We still probably need to find a nicer "online" icon.
Note that the icons are originally huge (518 pixels tall), so I just scaled them to 1/20 and they are now 26 pixels tall and about 12 wide. What this means is that they get stretched a little horizontally and the battery looks a little fat... this can be solved by just editing them manually and extending the size of the canvas.

If anybody want APM support, it could help if they post here the output of "cat /proc/apm".

Ive also gone on to implement support for multiple batteries, but wasn't sure exactly how to present the data: I currently present a total (an average of charge percentage and a sum of the times), but wasn't sure if it's correct/the best way.

_________________
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

Last edited by Dougal on Sun 12 Apr 2009, 05:35; edited 1 time in total
Back to top
View user's profile Send private message 
Tid


Joined: 09 Dec 2008
Posts: 16
Location: Canton, OH USA

PostPosted: Tue 16 Dec 2008, 16:33    Post subject:  

Does anyone know where I can get the traditional woof woof sound? I like the idea of adding the bark when the battery is getting low.

Dougal, check out these battery icons!! http://www.kde-look.org/content/show.php/WIreless%2BBattery+Icon?content=93465

Last edited by Tid on Tue 16 Dec 2008, 17:30; edited 1 time in total
Back to top
View user's profile Send private message 
smokey01


Joined: 30 Dec 2006
Posts: 1642
Location: South Australia

PostPosted: Tue 16 Dec 2008, 17:07    Post subject:  

Tid wrote:
Does anyone know where I can get the traditional woof woof sound? I like the idea of adding the bark when the battery is getting low.

Also, check out these battery icons!! http://www.kde-look.org/content/show.php/WIreless%2BBattery+Icon?content=93465


/usr/share/sounds/2barks.au

_________________
Puppy Software <-> Distros <-> Puppy Linux Tips
Back to top
View user's profile Send private message Visit poster's website 
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: Wed 17 Dec 2008, 10:19    Post subject:  

Dougal wrote:
If anybody want APM support, it could help if they post here the output of "cat /proc/apm".
You might my posts here interesting
Battery Monitoring Dotpup for JWM
Try booting with acpi=off and you should get apm enabled automatically.
My battery is now totally foobared so I can only posts results with ac power on, cat /proc/apm gives me
battery connected
Code:
1.16ac 1.2 0x03 0x01 0x03 0x0c -1% -1 ?

battery disconnected
Code:
1.16ac 1.2 0x03 0x01 0xff 0x80 -1% -1 ?

_________________
Will
contribute: community website, screenshots, puplets, wiki, rss
Back to top
View user's profile Send private message 
Tid


Joined: 09 Dec 2008
Posts: 16
Location: Canton, OH USA

PostPosted: Wed 17 Dec 2008, 20:43    Post subject:  

If I'm running pbatt-0.2.1 how would I write the logic to play the 2barks.au audio (woof woof) when the "charge now" box pops up?

Also, I believe it would go here in the code somewhere but I'm not sure?

Code:
give_low_batt_warning(){
   Xdialog --title "Pbatt" --msgbox "Battery charge is at $per%.\nSwitch to AC power NOW!" 7 30 >/dev/null 2>&1
Back to top
View user's profile Send private message 
brad_chuck

Joined: 15 Aug 2005
Posts: 284
Location: Appalachian Mountains

PostPosted: Fri 19 Dec 2008, 00:51    Post subject:  

Dougal - Your changes look great! Thanks for the input.

I hope to be able to work on this soon.

The plant I work at is shutting down for Christmas and they are letting the engineers off too!

I have to come up with some way to check both icon and tool tip with one call of the script.

Any ideas?

Just a new line? ie


Code:
#bevent --all
/path/icon.xpm
100%,2:34,Discharging
#
Back to top
View user's profile Send private message 
Dougal


Joined: 19 Oct 2005
Posts: 2505
Location: Hell more grotesque than any medieval woodcut

PostPosted: Sun 21 Dec 2008, 07:03    Post subject:  

I've made some more changes:
- I added the -u/--update option to the binary, to set the interval it checks the state (the default I set to 5 seconds).
- I made an attempt to add support for APM to the bevent script. (this is untested, as in my case the laptop is completely disfunctional when booting with APM...)
- The bevent script should support multiple batteries (with acpi). Not tested.

_________________
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

Last edited by Dougal on Sun 12 Apr 2009, 05:38; edited 1 time in total
Back to top
View user's profile Send private message 
brad_chuck

Joined: 15 Aug 2005
Posts: 284
Location: Appalachian Mountains

PostPosted: Thu 26 Mar 2009, 17:21    Post subject:  

Just so we don't duplicate work on this...

I am working on a pure Vala "C" implementation of PBatt.

I will be using the input from Dougal and HairyWill among other on this.

Check back in a few weeks...
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1239
Location: Ukraine

PostPosted: Thu 26 Mar 2009, 19:12    Post subject:  

Dear brad_chuck,

I tried compiling your pbatt prog in puppy 3.01 and got and error relating to "g_timeout_add_seconds". That is a function present in glib 2.14 and not in 2.10. The workaround for me was as follows - in line 75:
Code:
g_timeout_add(interval*1000, timer1, tray_icon);
.

Since you are switching to Vala, it may not matter, but some of us still use Slackpuppy (3.01) and like it.

Thanks for the app - which may come in handy for other purposes, such as monitoring the status of a network connection.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
brad_chuck

Joined: 15 Aug 2005
Posts: 284
Location: Appalachian Mountains

PostPosted: Thu 26 Mar 2009, 22:24    Post subject:  

Good to know. Thanks vovchik, I will not use g_timeout_add_seconds in the new program.

Thanks for the tip.
Back to top
View user's profile Send private message 
Dougal


Joined: 19 Oct 2005
Posts: 2505
Location: Hell more grotesque than any medieval woodcut

PostPosted: Fri 27 Mar 2009, 06:25    Post subject:  

vovchik wrote:
That is a function present in glib 2.14 and not in 2.10. The workaround for me was as follows - in line 75:
Code:
g_timeout_add(interval*1000, timer1, tray_icon);
.

I added that intentionally.
g_timeout_add_seconds doesn't cause a wakeup exactly one second away, it lets glib add it to an already existing one, approx. one second away, thus causing one cpu-wakeup less.

_________________
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind
Back to top
View user's profile Send private message 
brad_chuck

Joined: 15 Aug 2005
Posts: 284
Location: Appalachian Mountains

PostPosted: Fri 27 Mar 2009, 21:29    Post subject:  

command line switch...
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 3 [31 Posts]   Goto page: Previous 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Jump to:  

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


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0856s ][ Queries: 13 (0.0069s) ][ GZIP on ]