Battery Monitoring Dotpup for JWM
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
Battery Monitoring Dotpup for JWM
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!
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!
- Attachments
-
- batmon-0.1.0.tar.gz
- (2.44 KiB) Downloaded 2042 times
-
- batmon0.0.7.pup
- (21.92 KiB) Downloaded 2676 times
-
- batmon1.png
- (3.87 KiB) Downloaded 8128 times
-
- batmon2.png
- (3.04 KiB) Downloaded 7910 times
Last edited by brad_chuck on Mon 26 Feb 2007, 19:02, edited 7 times in total.
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
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?
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?
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
---------------------------------------------------------------------
#!/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, 04:31, edited 2 times in total.
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
yeah fixed it
Yeah I caught it.. This edit works for me so I updated the file on the main post.
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
clean ups
Updated the file for download.
Now black on green. Easy to read.
Also added picture.
Now black on green. Easy to read.
Also added picture.
- BarryK
- Puppy Master
- Posts: 9392
- Joined: Mon 09 May 2005, 09:23
- Location: Perth, Western Australia
- Contact:
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!
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!
It is a very small modification.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!
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
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.
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, 19:37, edited 1 time in total.
Just tried the dotpup. Works for me!
I'm running 2.12 beta. When I ran "Batmon" from the DotPups menu, a window popped up saying that the zdrv file was being copied to the same place as my pup_save file. It just sat there for a while, probably because there's just a couple Mbytes left on that partition. So I clicked in the corner to close the window and the computer rebooted. When I ran "Batmon" from the DotPups menu again, the percent of battery showed up in the task bar.
Maybe a 2.12 bug?
Thnaks!
I'm running 2.12 beta. When I ran "Batmon" from the DotPups menu, a window popped up saying that the zdrv file was being copied to the same place as my pup_save file. It just sat there for a while, probably because there's just a couple Mbytes left on that partition. So I clicked in the corner to close the window and the computer rebooted. When I ran "Batmon" from the DotPups menu again, the percent of battery showed up in the task bar.
Maybe a 2.12 bug?
Thnaks!
-
- Posts: 195
- Joined: Sat 21 Jan 2006, 05:35
- Location: Bedfordshire, UK
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
idea
Rickrandom, Try the new batmon-0.0.2.tar.gz first then if that does not work copy and paste the exact error message and I will try to work it out.
I just had an idea..... What do you guys think?
If we made the batmon into a front for a shell script that could control it
so say you could do something like
this way you could just update the shell script and bam it would do your bidding. Flash when battery is low or when it goes below freezing whatever.
Temperature , stock prices.........
I just had an idea..... What do you guys think?
If we made the batmon into a front for a shell script that could control it
so say you could do something like
Code: Select all
while [ 1 ] ;do
batmon -bg #000000 -fg #ffffff `batmon.sh`
sleep 10
batmon -bg #000000 -fg #ffffff `getfreemem.sh`
sleep 10
done
Temperature , stock prices.........