BatteryBuddy - A program to monitor Battery %

Miscellaneous tools
Message
Author
mow9902
Posts: 187
Joined: Wed 26 Nov 2008, 08:29

BatteryBuddy - A program to monitor Battery %

#1 Post by mow9902 »

I am not a programmer, and have always been hesitant to post anything I create. However, this forum has been very helpful to me on several occasions so I am finally going to give something useful (I hope) back to anyone who is interested.

I personally like to use my laptop 'off power' for as long as I can before recharging it. This means I need something which reminds me of the battery charge % and gives me warnings. Of course there are other battery monitoring scrips which people have provided, and I have used some of those. However, none of them quite gave me the functionality I wanted - so I tried to create my own. The result is this application I have called gmhBatteryBuddy

I make it available here for anyone who is interested. It :
- is portable - does not do any installs
- allows user to set up to 4 different warning levels in addition to the 'critical' and 'full' levels
- allows user to set sound and colour of the displayed warnings
- allows user to included in menu and startup via .desktop files.[/list]

Dependencies
The application utilises the following system components which must be present on your system for the application to run:
• acpi : To provide the measurements of power and battery status
• gxmessage : To provide the onscreen messages
• wavplay: To provide the audible sound warnings


Portability
The application has been designed to be portable ie
• it can be unzipped to any location and can be executed from that location
• it does not perform any install process on the host machine
• the only system changes made by the app are:
◦ the creation of a symbolic link /root/.config/autostart to gmhBatteryBuddy_engine (if that option is chosen by the user)
◦ the addition of a desktop file gmhBatteryBuddy.desktop in /usr/share/applications (if that option is chosen by the user)

To begin using –
• unzip the archive package into a folder of your choice
• change the attributes of these four files to make them executable
▪ BatteryBuddyRun.sh
▪ gmhBatteryBuddy.desktop
▪ gmhBatteryBuddy_engine
▪ gmhBatteryBuddy_status.sh
• Edit these 2 files and change the respective lines to reflect the folder/path you have chosen to store this application.
▪ gmhBatteryBuddy.desktop
▪ gmhBatteryBuddy_engine.desktop
• Click on BatteryBuddyRun.sh

I am not a professional programmer, and make no assertion that the code is:
• As efficient as it could be
• Free of logical or syntactical error

The zip archive can be download from my dropbox link here: https://www.dropbox.com/sh/y0re1sgsfsbx ... lEZCa?dl=0

april

#2 Post by april »

Can you show me whats in the programming scripts first please . Just make a directory on your dropbox with the source in it.
Last edited by april on Sat 25 Aug 2018, 04:49, edited 3 times in total.

mow9902
Posts: 187
Joined: Wed 26 Nov 2008, 08:29

#3 Post by mow9902 »

If you click on the dropbox link it will display the zip file. If you click on the zip file name it will display the contents
All of the source is shown there. It is just bash scripts with gtkdialog. You can view or download any or all files as you wish.

april

#4 Post by april »

Deleted
Last edited by april on Sat 25 Aug 2018, 04:48, edited 1 time in total.

mow9902
Posts: 187
Joined: Wed 26 Nov 2008, 08:29

#5 Post by mow9902 »

To allay any fears I have attached the zip file here to this post. I had to remove the PDF help file so that the zip size was small enough to post.

It is just a normal zip created using peazip.

What else can I do.
Attachments
gmhBatteryBuddy.zip
batterybuddy without the PDF help file
(86.53 KiB) Downloaded 78 times

mow9902
Posts: 187
Joined: Wed 26 Nov 2008, 08:29

#6 Post by mow9902 »

gmhBatteryBuddy_engine is one of the scipts contained in the application zip file. It is there.

However - I have also posted a second zip here with just that file so you can view the code.

If there continues to be concerns I will remove this content. I was trying to be helpful not create problems - but truly you can view all of the code for all of the scripts in the zip file. I'm not trying to hide anything.
Attachments
gmhBatteryBuddy_engine.zip
the script for gmhBatteryBuddy_engine
(2.58 KiB) Downloaded 77 times

mow9902
Posts: 187
Joined: Wed 26 Nov 2008, 08:29

#7 Post by mow9902 »

I have now also posted each individual file and each individual folder onto the dropbox location.

You should be able to read all code for all files.

If there is a problem with any of this code I will delete the post - but I cannot see anything strange.

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#8 Post by wiak »

april wrote:But what is in "gmhBatteryBuddy_engine"

Where does it come from . There is no source for that
As the author says, it is just a script and the original download is large because it contains a nice usage pdf along with some wav sound files (which inflate its size). I have only had a quick look at the code but looks fine to me.

Nicely produced. I'm on a Dog system and don't have battery on this laptop but I'll give your nice-looking app a try some time. Many thanks.

EDIT: @april: I see no reason geany or mhwaveedit etc should suddenly disappear. The BatterybuddyRun.sh script does contain fixmenus and jwm-reload, but that should only have a negative effect if there was already something wrong with your system (all these commands do is to refresh your jwm menu). You should have downloaded it to its own directory (which is what I always do) since it extracts all the files into the dir you put it. There is no chmod command anywhere in the scripts so I don't see how it could possibly change permissions on your dir. You can prove that to yourself by the way: In the dir where you have extracted the files check for chmod command with:

Code: Select all

grep -r 'chmod' *
wiak

mow9902
Posts: 187
Joined: Wed 26 Nov 2008, 08:29

#9 Post by mow9902 »

Thanks for that confirmation wiak.

Yes - the script BatteryBuddyRun.sh does contain:

fixmenus : so that the menu entry shows in the menu if the user chooses that option

jwm restart: so that any parameter changes the user makes via the GUI are immediately reflected back in the GUI without having to exit the app and start it again. (may not be the best way to do this, but this is what I came up with)

I also use fixwidgets in the script gmhBatteryBuddy_engine : IF pwidgets is being used this pwidgets restart ensures that the pwidgets battery % shown aligns with the % reported from my app. I found that at critical battery levels the two would sometimes report slightly different % because their 'refresh' cycles are not aligned.

april

#10 Post by april »

Yes agreed I was trying to open the engine and it would not . I now see Geany and the others have been lost for the time being so trying to open the engine as text was trying to open it in Open office which just hung . I assumed wrongly that it was a binary not having a ".sh" suffix .

My apologies . I'll fix the above posts.

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#11 Post by Flash »

April, that's about enough of that. You didn't "fix" anything. You made yet another ill-considered accusation and then deleted the post. If you can't do better than that, I'll have to ban you from the forum. Next time something seems to go wrong for you, take a deep breath and keep it to yourself while you try to find out more before jumping to the conclusion that some evil is afoot. And try to keep it civil, will you? And by the way, this is not an attack, it's a warning with an explanation. I hope it suffices.

User avatar
Revolverve
Posts: 255
Joined: Sat 08 Nov 2008, 21:01
Location: 45°17'28.8"N 72°16'08.8"W_avatar/ mira.ca

#12 Post by Revolverve »

mow9902,
Work great! see both tablet batteries here!!!
post everything you do/did,please!
Very nice gui too.

User avatar
Revolverve
Posts: 255
Joined: Sat 08 Nov 2008, 21:01
Location: 45°17'28.8"N 72°16'08.8"W_avatar/ mira.ca

#13 Post by Revolverve »

After restart (tahrpup64_JWM v2.3.4) autostart option enabled it did change my jwm theme and tray personal tweaks.I must admit there are still some of jwm management strange to me.

mow9902
Posts: 187
Joined: Wed 26 Nov 2008, 08:29

#14 Post by mow9902 »

That's disappointing to hear Revolverve

I have no idea why a jwm restart would have any impact.
I created this app on a tahrpup 6.0.2 system.

Should I pull this app from the forum so that there is no more controversy?

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#15 Post by Flash »

No, please don't. The only controversy I've seen was caused by april and that was a mistake.

april

#16 Post by april »

Flash wrote:April, that's about enough of that. You didn't "fix" anything. You made yet another ill-considered accusation and then deleted the post. If you can't do better than that, I'll have to ban you from the forum. Next time something seems to go wrong for you, take a deep breath and keep it to yourself while you try to find out more before jumping to the conclusion that some evil is afoot. And try to keep it civil, will you? And by the way, this is not an attack, it's a warning with an explanation. I hope it suffices.
Be my guest ..Get Fucked Prick

The forum is dead anyway. Its stuck in a rut and
Barry fell down it and is flailing around at the bottom ..you should join him.

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#17 Post by Mike Walsh »

@ mow9902:-
mow9902 wrote:Should I pull this app from the forum so that there is no more controversy?
No, no, no; don't do that.

This looks quite interesting, and it follows my own 'modus operandi'; that of providing choice in all things. The more choices Puppians have, the better.

Don't allow the somewhat erratic behaviour of certain Forum members to deter you from developing more stuff like this. They're usually the author of their own problems.....

And no need to be apologetic about it. You've got nowt to apologise for. Well done.


Mike. :wink:

User avatar
Revolverve
Posts: 255
Joined: Sat 08 Nov 2008, 21:01
Location: 45°17'28.8"N 72°16'08.8"W_avatar/ mira.ca

#18 Post by Revolverve »

mow9902
Removed? of course no!
Worst case,change revision from 1.0 to 0.? or the next to 1.1...
controversy? forget that...gone
To me it's just learning a little bit more ..now jwm and users...
There are plenty of users around to help with any glitches .
Looking at scripts,i dont find what lead to your jwm default theme.

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#19 Post by Mike Walsh »

@ mow9902:-

Just d/l'ed, extracted, and 'set things up', to have a 'look-see'. (This is on my Compaq desktop, so, obviously, no battery to check, yet). I'll be trying this out on the old Dell lappie before too long, so I'll give you a progress report as & when I do.

First impressions? Nice. Very professionally done.

I like it. Once again, well done. Keep it up, mate! :D


Mike. :wink:

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

#20 Post by bigpup »

Should I pull this app from the forum so that there is no more controversy?
Bringing up problems, suggestions, questions, and having to make code changes, is all part of offering software to Puppy.
I have never, I repeat never, seen a piece of offered software be 100%, at first offering.

Take it all in and if you want to make changes, please do!
If you do not, that is up to you as the developer of the software.

99.9% of us just want to make this a better piece of software.

If you ever think something is 100%, before it gets used in the real world, not going to happen!!! :lol: :lol:

Last program I worked on, for Puppy, took about 6 months of testing, tweaking, improvements, testing, several releases, etc...... before getting to final release.
Just got told about a problem that never showed up in testing, but did in real world use.
Final release had been out for about 2 years.
Time for code tweaking and the person that found the problem, offered the code change to fix it. :shock: :D :D
That is Puppy software :!: :!: :!: :!: :!: :!:
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)

Post Reply