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 Fri 18 Apr 2014, 08:54
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 1 of 3 [31 Posts]   Goto page: 1, 2, 3 Next
Author Message
brad_chuck

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

PostPosted: Tue 09 Dec 2008, 00:27    Post subject:  pbatt - Real GTK2 Battery Monitor
Subject description: Could not find... So I made one...
 

I wrote "batmon" a long time ago. Well this is what I was trying to do with "batmon"

Pbatt is a 6k battery monitoring tray icon.

This is not complete. I have been working on it for some time and thought it would be good to let others see it.

Pbatt uses the GTK2 tray icon. It sends commands to a shell script (bevent) every 2 seconds.

The idea is that bevent is YOUR program. Pbatt is like a framework for your battery script (bevent). Basically you get to decide what you would like it to do. What the tool tip is... What icons to show and when... What to do when you click the icon...

Or you can just leave it alone.

Below is a list of the functions that the bevent script should provide. (pevent does not have to be a shell script by the way)

bevent -i -> Returns an icon name ie "/root/my-icon.xpm"
bevent -t -> Returns the tool tip for the icon
bevent -l -> Handles the left mouse click on icon
bevent -r -> Handles the right mouse click on icon

Please post bugs or comments.


This is a good framework for other apps along the same lines. You could use the same program to monitor other things. Disk space... Wifi connection... really anything that you can get data on with a shell script (quite a few things).

I know there will be bugs with multiple batteries. I have not worked this part out yet. I only have one. Will need some help.

If you don't use the dotpet. Copy both bevent and pbatt somewhere in your path and run pbatt.
pbatt-0.0.1.tar.gz
Description 
gz

 Download 
Filename  pbatt-0.0.1.tar.gz 
Filesize  16.82 KB 
Downloaded  585 Time(s) 
pbatt-0.0.1.pet
Description 
pet

 Download 
Filename  pbatt-0.0.1.pet 
Filesize  4.62 KB 
Downloaded  856 Time(s) 
pbatt.png
 Description   
 Filesize   11.19 KB
 Viewed   2453 Time(s)

pbatt.png

Back to top
View user's profile Send private message 
Tid


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

PostPosted: Wed 10 Dec 2008, 14:40    Post subject:  

I am very new to Linux and I am running Boxpup 4.1.1 and realized there was no battery monitor notification on the desktop anywhere. I run puppy on a Dell 600m and need something showing my battery. I really don't like how asapm looks and have been trying to find something like your design however I don't know how to get it. Like I said, I am new to Linux and apologize for my ignorance. Will you please provide me some steps to get this app to work?

Thanks so much!
Back to top
View user's profile Send private message 
brad_chuck

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

PostPosted: Wed 10 Dec 2008, 20:48    Post subject:  

Click on the Pbatt-0.0.1.pet file above. When asked click on the "Open with petget" option.

Then click Install.

That's it.
Back to top
View user's profile Send private message 
iscraigh

Joined: 03 Sep 2006
Posts: 276

PostPosted: Wed 10 Dec 2008, 22:25    Post subject:  

I have included this in my soon to be released aspire one remaster.

Thanks very much

Craig
Back to top
View user's profile Send private message 
magerlab

Joined: 08 Jul 2007
Posts: 731

PostPosted: Thu 11 Dec 2008, 01:59    Post subject:  

is it possible to use this anyhow for keyboard layout indicator?
if a script reads data from xorg.conf( there's a line for keyboard layouts) and shows the current layout in the tray

i use now asapm -withdrawn for battery monitoring in boxpup
but i'll test bevent also

_________________
skype: desafimager
Back to top
View user's profile Send private message 
brad_chuck

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

PostPosted: Thu 11 Dec 2008, 08:56    Post subject:  

Yes you can monitor anything you like. All the GTK program does is ask bevent what to display every 2 seconds. So for right now open up /usr/local/bin/bevent and edit it.

I am planning on making this easier by letting you pass the name of the script file to Pbatt. Will change name as well to avoid confusion.

So for example you would type

Ptrayicon --script="keboardevent" --time="2"

Then keyboardevent would be a shell script that monitors the keyboard. --time would be how often it should update things.

check back later....

Don't like aspm for 2 reasons;

1. Looks bad / No tooltip.
2. Not flexible enough (I like to tinker)
Back to top
View user's profile Send private message 
HairyWill


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

PostPosted: Thu 11 Dec 2008, 09:34    Post subject:  

Nice.
I looked at this type of solution for the volume control. The problem in that instance was the response time. If you are twiddling a volume knob you expect the visual feedback immediately and I didn't want to call a shell script every 100 milliseconds to update the icon. In the case of background monitoring this reponse time is much less critical.

I'm not sure how expensive it is to reload the icon every cycle, you might consider storing the last icon name and then comparing with the new one before deciding whether to load it.

_________________
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: Thu 11 Dec 2008, 10:39    Post subject:  

Hey, thanks for the info. I opened the pbatt-0.0.1.pet with petget and installed the pbatt successfully. The system automatically placed a pbatt file in the startup and when I boot from my flash drive I get the "pluged in" icon in the tool bar, however when I unplug my charger I receive a message that says:

Battery Charge is at %
Switch to AC power NOW!

And has an ok button. No matter how many times I hit the ok, the message keeps popping up and I don't get the blue battery icon. I have to plug the computer back in to get rid of the message. Do you guys have any idea what I did wrong?
Back to top
View user's profile Send private message 
HairyWill


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

PostPosted: Thu 11 Dec 2008, 10:53    Post subject:  

what do you get for the following commands
Code:
ls /proc/acpi/battery
cat /proc/acpi/battery/BAT0/state
cat /proc/acpi/battery/BAT1/state

_________________
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: Thu 11 Dec 2008, 11:02    Post subject:  

BATO BAT1

present: yes
capacity state: ok
charging state: charging
present rate: 8774mw

present: no

also, when I unplug the laptop and run cat /proc/acpi/battery/BAT0/state I get:

present: yes
capacity state: ok
charging state: discharging
present rate: 16608mw
remaining capacity: 53000mwh
present voltage: 12312mv
Back to top
View user's profile Send private message 
brad_chuck

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

PostPosted: Thu 11 Dec 2008, 20:24    Post subject:  

Replace line 34 in /usr/local/bin/bevent with;

Code:
for a in BAT0; do


That should "fix" your system. I will have to update the code to look for this..

Thanks for finding the bug.
Back to top
View user's profile Send private message 
Tid


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

PostPosted: Thu 11 Dec 2008, 20:45    Post subject:  

Awesome, thanks for the insight!! Works well.
Back to top
View user's profile Send private message 
ttuuxxx


Joined: 05 May 2007
Posts: 10730
Location: Ontario Canada,Sydney Australia

PostPosted: Sat 13 Dec 2008, 13:51    Post subject:  

Hi I don't use a laptop but I came across some GPL icons you might want to use?
http://www.e17-stuff.org/content/show.php/Glossy+Power+Icon?content=73935
ttuuxxx

_________________
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games Smile

Back to top
View user's profile Send private message Visit poster's website 
Dougal


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

PostPosted: Sun 14 Dec 2008, 06:52    Post subject:  

I'm not really fond of these apps that use scripts to get info...
In any case, I updated the script so it only does what is needed for the option it is run with.
I'll probably add support for APM andacpi-in-/sys today, too.

_________________
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:26; edited 1 time in total
Back to top
View user's profile Send private message 
ttuuxxx


Joined: 05 May 2007
Posts: 10730
Location: Ontario Canada,Sydney Australia

PostPosted: Sun 14 Dec 2008, 07:32    Post subject:  

Hi guys I looked at the scrip and it looks like your only using 3 icons, full, half-full and empty shouldn't you have 1 more icon before empty, like 1/4 or 25% left, Its a bit of a stretch to go from half to straight empty, would most people think well its ok I have 50% left and 2 seconds later its emptied.
Or maybe a popup warning "Danger will Robertson you have on 10% left to your battery" The robot voice would be cool. LOL
ttuuxxx
Or maybe just the tradition puppy bark you hear on startup like 3 times in a row?
DangerWill.tar.gz
Description 
gz

 Download 
Filename  DangerWill.tar.gz 
Filesize  15.89 KB 
Downloaded  489 Time(s) 

_________________
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games Smile

Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 3 [31 Posts]   Goto page: 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.0683s ][ Queries: 12 (0.0043s) ][ GZIP on ]