[SOLVED] Two batteries in polybar


#1

I have 2 batteries on my Lenovo ThinkPad T470, but I can only see one battery - iternal. Even if I change BAT0 to BAT1 in /usr/share/doc/ploybar/config. I also tried to create 2 battery modules, but it didn’t help either.
Had anybody made 2 bat’s displayed in polybar?


#2

Ok, sorry, I solved it by changing ~/.config/polybar/modules.conf. I actually started to change not that one config)


#3

Glad that you fixed it yourself. Keep it on.


#4

@Haze Happy you’ve got it worked out

A better explanation of how and marking that post as the ‘solution’ would benefit others with the same issue.

Textbox bottom toolbar > box with the checkmark

Thanks man :slight_smile:


#5

Hi, I have the same problem with battery module with my T450s, how did you solved it? What did you change?


#6

Create another module in ~/.config/polybar/modules.conf, name it for example [module/battery-one] and copy-paste the content of [module/battery], change there preference battery = BAT0 to BAT1.
Add second module to your bar in ~/.config/polybar/config.
That should work, ask if you would have any question, I will be glad to help.


#7

So now you have 2 icons showing on the bar? I did that but it didn’t solve my problem with the icon showing either 100% or 99% all the time, no real time discharging. Also I wanted 1 icon to show combined charge.


#8

Yes, I have two icons and it seems more comfortable for me. I’m not sure why it might not work correctrly in your case, check that ls /sys/class/power_supply consist of AC BAT0 and BAT1 (if other, you probably should use your names in module preferences)
In order to show combined charge you need to write some custom scripts for polybar. Visit github-wiki of polybar https://github.com/jaagr/polybar/wiki/Module:-script for more
For scripts you might use acpi?