Script for indicator of the battery charge

Hello, the community!

I’ve been use Mabox for a year now.
I likt it’s simplicity and the different fonctions available.

I bought my first laptop ten years ago and was then confronted to three faulty issues: not updated and obsolete softwares, a keyboard and a broken battery.

When I discovered Mabox, I searched for a code for the battery on the conky but I not found.

I decided to write my first code line to obtein a indicator of the battery charge.

Today, my script bash is ready and I want to share it you, dear Myboxers friends

For computer with old XP:

${offset10}${goto40}${color}battery${battery_percent Bato}%$battery

For computer with old Vista and others:

${offset10}${goto40}${color}battery$alignr$battery

Enjoy!

5 Likes

Thanks for the tip!
I had to fiddle a little bit around. Not every variable worked in my setting. Could it be, you meant ‘voffset’? At least on my conkyrc it’s like that. But I have no clue, didn’t bother much about customising my conky until now.

That’s what I came up with by now:

${voffset 10}$alignr${color}battery ${color2}$battery

2022-04-23_23-24

4 Likes

Hello, @Faehnchen

I not know ‘‘offset’’, i juste past a original code since Internet in fact and I adapted on my computer.

Your script is good: Is miss the end of code.
I’am see the same problem with my old laptop and do not use a space in code.

Your computer manufactured before 2010, i think.

Are you try taken and past my first script ?

Sorry, for my bed english, I coming next wednesday with dictionnary for help

3 Likes

No problem! I use this all the time: :wink:
https://www.leo.org/anglais-fran%C3%A7ais/

Here is what the first code does you posted and beneath that what I changed.


You see, the ‘voffset’ has an effect while the above code has no effect. Perhaps someone can give a hint why the same code works on one machine and on another one does not. Could you make a screenshot of your conky please, so I get an idea how it looks on your computer?

I have a Lenovo V320 from 2017 I guess but with a older chipset, but definitely not before 2010.
2022-04-25_01-30

I don’t have a high-end machine really, but with Mabox this laptop flies like an ace. I guess it has more to do with the chipset, the manufacturer and what parts or sensors are on the main-board, but I could be wrong.

2 Likes

voffset 10 moves the text vertically by n pixels
offset 10 moves it over, to the right, by n pixels
see http://conky.sourceforge.net/variables.html for a full explanation.

3 Likes

Hello @piquet! And thanks for this information!

1 Like

Hello, @Faehnchen

Use my second script and writing after this code with not spaces:
$color2${goto40}$alignr${battery_bar 4,165}

I think Is good.

This Is my screen:

3 Likes