Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Battery module doesn't update unless I reload #2649

Closed
5 tasks done
HotMonkeyWings opened this issue Mar 15, 2022 · 12 comments · Fixed by #2677
Closed
5 tasks done

[Bug]: Battery module doesn't update unless I reload #2649

HotMonkeyWings opened this issue Mar 15, 2022 · 12 comments · Fixed by #2677

Comments

@HotMonkeyWings
Copy link

Checklist

  • I have read the appropriate section in the contributing guidelines
  • I believe this issue is a problem with polybar itself and not a misconfiguration on my part
  • I have searched for other open and closed issues that may have already reported this problem
  • I have checked the known issues page for this problem.
  • I have followed the debugging guide to narrow down the problem to a minimal config.

Steps to reproduce

  1. Add battery module to polybar
  2. Run polybar

Minimal config

[module/battery]
type = internal/battery

full-at = 99
low-at = 5

battery = BAT1
adapter = ACAD

format-charging =  <label-charging>
format-discharging = <ramp-capacity> <label-discharging>

ramp-capacity-4 = 
ramp-capacity-3 = 
ramp-capacity-2 = 
ramp-capacity-1 = 
ramp-capacity-0 = 

label-charging = %percentage%
label-discharging = %percentage%
label-full = FULL

label-charging-foreground = ${colors.green}
label-discharging-foreground = ${colors.yellow}
label-full-foreground = ${colors.green}

Polybar log

notice: Parsing config file: /home/monkeywings/.config/polybar/config.ini
notice: Listening for IPC messages (PID: 4348)
notice: pulseaudio: using default sink alsa_output.pci-0000_05_00.6.analog-stereo
notice: Loaded font "JetBrains Mono:style=Regular:size=14" (name=FreeSans, offset=1, file=/usr/share/fonts/gnu-free/FreeSans.otf)
notice: Loaded font "JetBrains Mono:style=Bold:size=14" (name=FreeSans, offset=2, file=/usr/share/fonts/gnu-free/FreeSansBold.otf)
notice: Loaded font "Iosevka,Iosevka Nerd Font:style=Regular,Book:size=26" (name=Iosevka, offset=2, file=/usr/share/fonts/TTF/Iosevka Nerd Font Complete Mono.ttf)

Expected behavior

Battery module updates the percentage every 5 seconds. (I've tried adding poll-interval in the config, but no luck.)

Actual behavior

Battery module stays at a fixed percentage until I decide to reload my window manager (Ultimately reloading polybar).

Window Manager and Version

bspwm-git 0.9.10.r36.g1560df3-1

Linux Distribution

Arch Linux

Polybar version

polybar-git 3.6.1.r20.g3079acb3-1

Additional Context / Screenshots

No response

@patrick96
Copy link
Member

Does the module never reload or simply not after poll-interval? Testing locally, it seems the module only updates every two minutes (unless I plug/unplug the power cable), but it does update.

It does look like poll-interval isn't really useful though.

@HotMonkeyWings
Copy link
Author

@patrick96 It behaves the same way with and without poll-interval. No refreshing the battery status unless I reload manually

@patrick96
Copy link
Member

Could you run polybar with trace logging (polybar -l trace ...) and let it run for about 5 minutes? The output of that should show exactly what is happening under the hood. Make sure to use a config which only has the battery module enabled, otherwise this will produce a lot of unnecessary output.

@HotMonkeyWings
Copy link
Author

image
Apparently it is pollying it every five seconds, although it doesn't change it visually. Thats weird. I tried running it with all the modules together and noticed that it still polls the values. Very weird!

@patrick96
Copy link
Member

The polling messages are misleading. It doesn't actually update anything. What it does is it reads the polled file (but discards the read value). I think the idea was that this is supposed to trigger an inotify event on the file, but that doesn't work.

The message you should look out for is: Inotify event reported for ...

This message indicates the module was updated. For me that appears every two minutes, so you need to let it run at least that long for it to appear.

@nDanielGH
Copy link

I have the same issue on i3wm.

@patrick96
Copy link
Member

@nDanielGH By "the same" do you mean that the module never updates or only about every two minutes?

@nDanielGH
Copy link

nDanielGH commented Mar 19, 2022

@patrick96 The battery module never updates (unless I reload). Actually, I've noticed my i3 module won't update when I switch desktops, either. Note that unlike OP, I haven't isolated modules in my config, I just noticed the issue and came here to see if I'm not the only one.

Edit: Sometimes my i3wm module won't update either, but sometimes it will. If I remove the battery module it seems to always work. Let's just ignore this (possibly unrelated) issue for now.

@kita99
Copy link

kita99 commented Apr 3, 2022

Having the same problem on a fresh Arch Linux install + i3wm, logs show frequent polls but no Inotify events ever arrive.

patrick96 added a commit to patrick96/polybar that referenced this issue Apr 4, 2022
@patrick96 patrick96 added this to the 3.6.3 milestone Apr 4, 2022
@patrick96
Copy link
Member

Can someone try out the fix in #2677?

patrick96 added a commit to patrick96/polybar that referenced this issue Apr 4, 2022
@kita99
Copy link

kita99 commented Apr 4, 2022

@patrick96 Can confirm that the fix works beautifully.

@patrick96
Copy link
Member

Thanks for testing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants