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 Sun 21 Sep 2014, 06:05
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Battery Monitoring Dotpup for JWM
Moderators: deshlab, Flash, GuestToo, Ian, JohnMurga, Lobster
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 6 [87 Posts]   Goto page: 1, 2, 3, 4, 5, 6 Next
Author Message
brad_chuck

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

PostPosted: Thu 02 Nov 2006, 22:51    Post subject:  Battery Monitoring Dotpup for JWM
Subject description: NEW test version useing GINS ( cleaner and with changing colors )
 

UPDATE Feb 26 2007

In addition to the regular batmon script I added a totally redone program( batmon-0.1.0 ). This uses GINS to have a GTK 2 look to it. This also changes color ( green to yellow to red )

Just for testers





This is a dotpup for batmon.

batmon is a simple program that shows the status of your battery in the taskbar of JWM. The dopup installs batmon and a script that sets it up for you.

To install just install the dotpup and click on the batmonsetup.sh script in the ROX window that pops up at the end. Then just restart JWM and your batmon should be in your JWM taskbar.

The setup script (batmonsetup.sh)

1. loads modules for your battery
2. Edits your init scripts so that the modules will be loaded at boot time
3. If you have a Toshiba laptop will install modules and set up LCD control script.
4. Adds the batmon program to the JWM task bar.

This dotpup should be rock solid but it may have bugs.

Below is a picture of what it should look like.

If added to the main distro the delivery method could be in the menu of freememapplet. There is also a picture of what this could look like. The dotpup does not edit freememapplet.

Please test!
batmon-0.1.0.tar.gz
Description 
gz

 Download 
Filename  batmon-0.1.0.tar.gz 
Filesize  2.44 KB 
Downloaded  1672 Time(s) 
batmon0.0.7.pup
Description 
pup

 Download 
Filename  batmon0.0.7.pup 
Filesize  21.92 KB 
Downloaded  2381 Time(s) 
batmon1.png
 Description   
 Filesize   3.87 KB
 Viewed   6833 Time(s)

batmon1.png

batmon2.png
 Description   
 Filesize   3.04 KB
 Viewed   6765 Time(s)

batmon2.png


Last edited by brad_chuck on Mon 26 Feb 2007, 15:02; edited 7 times in total
Back to top
View user's profile Send private message 
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Thu 02 Nov 2006, 23:55    Post subject:  

all it did for me was put a "-%" with no number next to blinky. I currently have my laptop unplugged running off the battery. I have battery modprobed and can see my charge left with wmpower.
Back to top
View user's profile Send private message 
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Fri 03 Nov 2006, 00:00    Post subject:  

I see why too. You're batmon.sh is looking for BAT1 but mine is BAT0.
Back to top
View user's profile Send private message 
brad_chuck

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

PostPosted: Fri 03 Nov 2006, 00:09    Post subject: Great thanks  

Thanks. I almost added some code to deal with that but did not.

I will go back and fix it.

do you have /proc/acpi/ac_adapter/ADP1/state or /proc/acpi/ac_adapter/ADP0/state ?

More Testers?
Back to top
View user's profile Send private message 
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Fri 03 Nov 2006, 00:20    Post subject:  

nope, this works though:

---------------------------------------------------------------------

#!/bin/sh

cd /proc/acpi/battery/
for a in `ls`
do
rc="`cat /proc/acpi/battery/$a/state | grep "remaining capacity:" | sed -n 's/remaining capacity: //p' | sed -n 's/ mWh//p'`"
cap="`cat /proc/acpi/battery/$a/info | grep "last full cap" | sed -n 's/last full capacity: //p' | sed -n 's/ mWh//p'`"
done
cd /proc/acpi/ac_adapter/
for a in `ls`
do
let "per=(($rc*100)/($cap))"
if [ "`cat /proc/acpi/ac_adapter/$a/state | grep "on-line"`" == "" ]; then
acon="-"
else
acon="+"
fi
done
echo -n "${acon}${per}%"

----------------------------------------------------------------------------------------

you'll need to enter the following commands

modprobe battery
modprobe ac
batmon.sh

Last edited by plinej on Fri 03 Nov 2006, 00:31; edited 2 times in total
Back to top
View user's profile Send private message 
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Fri 03 Nov 2006, 00:22    Post subject:  

BTW, I don't have ADP0 or ADP1, I have AC.

My revision on your script would obviously only take the first directory in `ls` but you should only have one anyway right?
Back to top
View user's profile Send private message 
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Fri 03 Nov 2006, 00:32    Post subject:  

Whoops, had the wrong directory for the 2nd part of your script but I revised my post to correct that.
Back to top
View user's profile Send private message 
brad_chuck

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

PostPosted: Fri 03 Nov 2006, 00:38    Post subject: yeah fixed it  

Yeah I caught it.. This edit works for me so I updated the file on the main post.
Back to top
View user's profile Send private message 
plinej

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Fri 03 Nov 2006, 00:43    Post subject:  

It's still the same file for download.

Okay, now it's fixed. Thanks alot for this!
Back to top
View user's profile Send private message 
brad_chuck

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

PostPosted: Fri 03 Nov 2006, 02:09    Post subject: clean ups  

Updated the file for download.

Now black on green. Easy to read.

Also added picture.
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Fri 03 Nov 2006, 05:24    Post subject:  

This is great!
Just a thought, you don't have to do it -- why not combine with freememapplet
and share the same display, flip between the two every few seconds. Maybe you could even combine the Bash script to return both informations. This would be
one less background daemon polling and taking up cpu time.

Note, MU has a modified version of freememapplet that ...well, I can't
remember exactly but it doesn't display a normal window, enables display
of a more compact window that is less than the full height of the taskbar.
But there were problems I think with how it has to be entered into .jwmrc.
...anyway, MU can give further details!
Back to top
View user's profile Send private message Visit poster's website 
JB4x4

Joined: 30 Jul 2006
Posts: 256

PostPosted: Fri 03 Nov 2006, 06:28    Post subject:  

Great little program, one thing though..

The battery in my laptop lists capacity as "mAh" instead of "mWh". I had to change the script accordingly to have it read. Would there be way to add this into the script?
Back to top
View user's profile Send private message Yahoo Messenger 
JB4x4

Joined: 30 Jul 2006
Posts: 256

PostPosted: Fri 03 Nov 2006, 06:31    Post subject:  

double post
Last edited by JB4x4 on Fri 03 Nov 2006, 21:45; edited 1 time in total
Back to top
View user's profile Send private message Yahoo Messenger 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Fri 03 Nov 2006, 08:18    Post subject:  

BarryK wrote:
Note, MU has a modified version of freememapplet that ...well, I can't
remember exactly but it doesn't display a normal window, enables display
of a more compact window that is less than the full height of the taskbar.
But there were problems I think with how it has to be entered into .jwmrc.
...anyway, MU can give further details!


It is a very small modification.
The applet is not displayed in a Gtk-window, but in an "eggtray". This is a technique, that it is displayed automatically as a trayicon in the tray-area.
Like this it can be used in Icewm and KDE, too.

details:
http://www.murga.org/~puppy/viewtopic.php?t=4208

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

Joined: 13 Aug 2006
Posts: 1522

PostPosted: Fri 03 Nov 2006, 10:31    Post subject:  

I made a dotpup that includes a pre-install script that writes the necessary lines to your .jwmrc-tray file (it greps for batmon first and if it finds that than it exits). I modified the batmon.sh script again so it should work for JB4x4. After installing the dotpup you of course need to restart JWM to see batmon in your dotpup menu. Click on it and it will automatically modprobe battery & ac and start batmon. You'll then need to restart JWM again to see the percentage in your taskbar.

Thanks again brad, I've been wanting something like this for jwm.

I removed this dotpup because Brad updated the package.

Last edited by plinej on Fri 03 Nov 2006, 15:37; edited 1 time in total
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 6 [87 Posts]   Goto page: 1, 2, 3, 4, 5, 6 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.0835s ][ Queries: 12 (0.0151s) ][ GZIP on ]