# Script for indicator of the battery charge

**URL:** https://forum.maboxlinux.org/t/script-for-indicator-of-the-battery-charge/925
**Category:** Conky
**Created:** [April 23, 2022, 1:08pm UTC](https://forum.maboxlinux.org/t/script-for-indicator-of-the-battery-charge/925 "2022-04-23T13:08:22Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Guillaume](https://forum.maboxlinux.org/letter_avatar_proxy/v4/letter/g/c67d28/32.png) [@Guillaume](https://forum.maboxlinux.org/u/Guillaume)
#### Post date: [April 23, 2022, 1:08pm UTC](https://forum.maboxlinux.org/t/script-for-indicator-of-the-battery-charge/925/1 "2022-04-23T13:08:22Z")

</div>

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:

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

```

For computer with old Vista and others:

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

```

Enjoy!

---

<div class="post-metadata">

### Author: ![Faehnchen](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/faehnchen/32/1356_2.png) [@Faehnchen](https://forum.maboxlinux.org/u/Faehnchen)
#### Post date: [April 23, 2022, 9:32pm UTC](https://forum.maboxlinux.org/t/script-for-indicator-of-the-battery-charge/925/2 "2022-04-23T21:32:11Z")

</div>

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:

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

```

 ![2022-04-23_23-24](https://forum.maboxlinux.org/uploads/default/original/2X/7/7b7565159e179695af4eff3eeb5355180aa85b96.png)

---

<div class="post-metadata">

### Author: ![Guillaume](https://forum.maboxlinux.org/letter_avatar_proxy/v4/letter/g/c67d28/32.png) [@Guillaume](https://forum.maboxlinux.org/u/Guillaume)
#### Post date: [April 24, 2022, 6:43pm UTC](https://forum.maboxlinux.org/t/script-for-indicator-of-the-battery-charge/925/3 "2022-04-24T18:43:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Faehnchen](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/faehnchen/32/1356_2.png) [@Faehnchen](https://forum.maboxlinux.org/u/Faehnchen)
#### Post date: [April 25, 2022, 12:02am UTC](https://forum.maboxlinux.org/t/script-for-indicator-of-the-battery-charge/925/4 "2022-04-25T00:02:48Z")

</div>

No problem! I use this all the time: 😉  
[https://www.leo.org/anglais-fran%C3%A7ais/](https://www.leo.org/anglais-fran%C3%A7ais/)

Here is what the first code does you posted and beneath that what I changed.  
 ![2022-04-25_01-26](https://forum.maboxlinux.org/uploads/default/optimized/2X/a/a497012c0c10f377a9ed43fbfc90672755d6ac77_2_690x35.png)  
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](https://forum.maboxlinux.org/uploads/default/original/2X/e/ecd1164fd119b8e6d663682532776a3821f289cb.png)

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.

---

<div class="post-metadata">

### Author: ![piquet](https://forum.maboxlinux.org/letter_avatar_proxy/v4/letter/p/7bcc69/32.png) [@piquet](https://forum.maboxlinux.org/u/piquet)
#### Post date: [April 25, 2022, 8:15am UTC](https://forum.maboxlinux.org/t/script-for-indicator-of-the-battery-charge/925/5 "2022-04-25T08:15:42Z")

</div>

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](http://conky.sourceforge.net/variables.html) for a full explanation.

---

<div class="post-metadata">

### Author: ![Guillaume](https://forum.maboxlinux.org/letter_avatar_proxy/v4/letter/g/c67d28/32.png) [@Guillaume](https://forum.maboxlinux.org/u/Guillaume)
#### Post date: [April 25, 2022, 4:20pm UTC](https://forum.maboxlinux.org/t/script-for-indicator-of-the-battery-charge/925/6 "2022-04-25T16:20:40Z")

</div>

Hello @piquet! And thanks for this information!

---

<div class="post-metadata">

### Author: ![Guillaume](https://forum.maboxlinux.org/letter_avatar_proxy/v4/letter/g/c67d28/32.png) [@Guillaume](https://forum.maboxlinux.org/u/Guillaume)
#### Post date: [April 25, 2022, 4:25pm UTC](https://forum.maboxlinux.org/t/script-for-indicator-of-the-battery-charge/925/7 "2022-04-25T16:25:24Z")

</div>

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:

 ![Mabox_2019-02-02-04-19-143975913](https://forum.maboxlinux.org/uploads/default/original/1X/2d645d2aff753bf37fdd0f3c0c8ca64390c23c26.jpeg)
