# Problem with Polybar battery

**URL:** <https://forum.endeavouros.com/t/problem-with-polybar-battery/34366>\
**Category:** Newbie\
**Created:** [November 29, 2022, 2:11pm UTC](https://forum.endeavouros.com/t/problem-with-polybar-battery/34366 "2022-11-29T14:11:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![LudoLambru](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ludolambru/32/48365_2.png) [@LudoLambru](https://forum.endeavouros.com/u/LudoLambru)\
**Post date:** [November 29, 2022, 2:11pm UTC](https://forum.endeavouros.com/t/problem-with-polybar-battery/34366/1 "2022-11-29T14:11:37Z")

</div>

Hi, I’m trying to set up the Polybar in my new bstwm. In particular, I want to show the percentage of my battery. I understood that I can change the /etc/polybar/confing.ini, and I did that by adding the battery module as is written in the GitHub wiki of Polybar. I also changed the “battery” and the “adapter” value reading them with ls -l /sys/class/power\_supply/. But despite my efforts and my research, it does not work, and I don’t know why. Could someone help me?  
I post the module that I’m using now:

```auto
[module/battery]

type = internal/battery

low-at = 5

full-at = 100

battery = BAT1

adapter = ACAD

poll-interval = 5

time-format = %H:%M

format-charging = <animation-charging> <label-charging>

format-discharging = <label-discharging>

format-full = <label-full>

format-low = <label-low> <animation-low>

label-charging = Batt. Charging %percentage%%

label-discharging = Batt. %percentage%%

label-full = Batt. Full - %percentage%%

label-low = Batt. Low - %percentage%%

animation-charging-0 = 

animation-charging-1 = 

animation-charging-2 = 

animation-charging-3 = 

animation-charging-4 = 

animation-charging-framerate = 750

animation-low-0 = !

animation-low-1 =

animation-low-framerate = 200

```

---

<div class="post-metadata">

**Author:** ![anon13373109](https://forum.endeavouros.com/letter_avatar_proxy/v4/letter/a/43a26b/32.png) [@anon13373109](https://forum.endeavouros.com/u/anon13373109)\
**Post date:** [November 29, 2022, 2:24pm UTC](https://forum.endeavouros.com/t/problem-with-polybar-battery/34366/2 "2022-11-29T14:24:37Z")

</div>

Try this:

```auto
[module/battery]
type = internal/battery

; This is useful in case the battery never reports 100% charge
full-at = 99

; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/
battery = BAT1
adapter = ACAD

; If an inotify event haven't been reported in this many
; seconds, manually poll for new values.
;
; Needed as a fallback for systems that don't report events
; on sysfs/procfs.
;
; Disable polling by setting the interval to 0.
;
; Default: 5
poll-interval = 2

; see "man date" for details on how to format the time string
; NOTE: if you want to use syntax tags here you need to use %%{...}
; Default: %H:%M:%S
time-format = %H:%M

; Available tags:
; <label-charging> (default)
; <bar-capacity>
; <ramp-capacity>
; <animation-charging>
format-charging = <label-charging>
format-charging-prefix = ""
format-charging-prefix-foreground = ${color.green}

; Available tags:
; <label-discharging> (default)
; <bar-capacity>
; <ramp-capacity>
; <animation-discharging>
format-discharging = <label-discharging>
format-discharging-prefix = ""
format-discharging-prefix-foreground = ${color.pink}

; Available tags:
; <label-full> (default)
; <bar-capacity>
; <ramp-capacity>
format-full = <label-full>
format-full-prefix = 
format-full-prefix-foreground = ${color.red}

; Available tokens:
; %percentage% (default)
; %time%
; %consumption% (shows current charge rate in watts)
label-charging = " %percentage%%"

; Available tokens:
; %percentage% (default)
; %time%
; %consumption% (shows current discharge rate in watts)
label-discharging = " %percentage%%"

; Available tokens:
; %percentage% (default)
label-full = " Full"

; Only applies if <ramp-capacity> is used
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 

; Only applies if <bar-capacity> is used
;bar-capacity-width = 10

; Only applies if <animation-charging> is used
animation-charging-0 = 
animation-charging-1 = 

; Framerate in milliseconds
animation-charging-framerate = 750

; Only applies if <animation-discharging> is used
;;animation-discharging-0 = ${battery.anim0}
;;animation-discharging-1 = ${battery.anim1}

; Framerate in milliseconds
;animation-discharging-framerate = 500

;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

```

Change the color values to your liking.

---

<div class="post-metadata">

**Author:** ![LudoLambru](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ludolambru/32/48365_2.png) [@LudoLambru](https://forum.endeavouros.com/u/LudoLambru)\
**Post date:** [November 29, 2022, 2:32pm UTC](https://forum.endeavouros.com/t/problem-with-polybar-battery/34366/3 "2022-11-29T14:32:03Z")

</div>

It doesn’t work

---

<div class="post-metadata">

**Author:** ![anon13373109](https://forum.endeavouros.com/letter_avatar_proxy/v4/letter/a/43a26b/32.png) [@anon13373109](https://forum.endeavouros.com/u/anon13373109)\
**Post date:** [November 29, 2022, 2:33pm UTC](https://forum.endeavouros.com/t/problem-with-polybar-battery/34366/4 "2022-11-29T14:33:56Z")

</div>

What output do you see on your polybar?

---

<div class="post-metadata">

**Author:** ![LudoLambru](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ludolambru/32/48365_2.png) [@LudoLambru](https://forum.endeavouros.com/u/LudoLambru)\
**Post date:** [November 29, 2022, 2:35pm UTC](https://forum.endeavouros.com/t/problem-with-polybar-battery/34366/5 "2022-11-29T14:35:54Z")

</div>

Nothing in particular, I simply cannot see the battery percentage. It does not give me an error. But now polybar does not show me the time

---

<div class="post-metadata">

**Author:** ![anon13373109](https://forum.endeavouros.com/letter_avatar_proxy/v4/letter/a/43a26b/32.png) [@anon13373109](https://forum.endeavouros.com/u/anon13373109)\
**Post date:** [November 29, 2022, 2:37pm UTC](https://forum.endeavouros.com/t/problem-with-polybar-battery/34366/6 "2022-11-29T14:37:32Z")

</div>

you did add the module in your config.ini like so:

```auto
modules-left = workspaces
modules-center = date weather
modules-right = battery sep0 network sep0 updates sep0 cpu sep0 temperature sep0 memory_bar sep0 gpu sep0 volume launcher

```

and reload polybar?

---

<div class="post-metadata">

**Author:** ![LudoLambru](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ludolambru/32/48365_2.png) [@LudoLambru](https://forum.endeavouros.com/u/LudoLambru)\
**Post date:** [November 29, 2022, 2:43pm UTC](https://forum.endeavouros.com/t/problem-with-polybar-battery/34366/7 "2022-11-29T14:43:46Z")

</div>

Ok, I forgot it. Now it works, it does not have the icons, but it works.  
In particular, the error related to the icon is\<.

warn: Dropping unmatched character  (U+e91c) in ’  53%’

---

<div class="post-metadata">

**Author:** ![anon13373109](https://forum.endeavouros.com/letter_avatar_proxy/v4/letter/a/43a26b/32.png) [@anon13373109](https://forum.endeavouros.com/u/anon13373109)\
**Post date:** [November 29, 2022, 2:45pm UTC](https://forum.endeavouros.com/t/problem-with-polybar-battery/34366/8 "2022-11-29T14:45:56Z")

</div>

for some icons you’ll have to install the correct font and add them to your config.ini like so:

```auto
font-4 = "Font Awesome 6 Free:bold:pixelsize=10;2"
font-3 = "Weather Icons:style=Regular:size=15;3"       
font-2 = "Iosevka Nerd Font:size=17.5;3"              
font-1 = "feather:size=17;3"                          
font-0 = "Monofur Nerd Font:style=Retina:size=15;3"

```

[https://wiki.archlinux.org/title/Fonts#Installation](https://wiki.archlinux.org/title/Fonts#Installation)

---

<div class="post-metadata">

**Author:** ![LudoLambru](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/ludolambru/32/48365_2.png) [@LudoLambru](https://forum.endeavouros.com/u/LudoLambru)\
**Post date:** [November 29, 2022, 3:02pm UTC](https://forum.endeavouros.com/t/problem-with-polybar-battery/34366/9 "2022-11-29T15:02:46Z")

</div>

Ok thanks, I understood how I can modify it. I put the flag solution in the answer above.

---

<div class="post-metadata">

**Author:** ![system](https://forum.endeavouros.com/uploads/default/original/2X/9/9ea52f9fd5ef8e609e593c362d61a36295f48be8.png) [@system](https://forum.endeavouros.com/u/system)\
**Post date:** [December 1, 2022, 3:03pm UTC](https://forum.endeavouros.com/t/problem-with-polybar-battery/34366/10 "2022-12-01T15:03:37Z")

</div>

Closed on December 1, 2022, 3:03pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
