Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

Make battery module update on plugging/unplugging again (refs #2519)

Open schmop opened this issue 1 year ago • 1 comments

When switching how you listen for battery plugging status events, the battery status will instantly update again! Instead of inotify events on the /sys/class/.../ files, it is recommended to listen to udev netlink kernel events.

Closes #2444 Closes #2519

I will aid implementing this, because I'm new to this project. I will try to make this code look more like the backlight_backend, which also uses the udev netlink interfaces.

schmop avatar Jul 24 '24 23:07 schmop

So it seems, that the udev kernel events are sent very early. The battery status "Charging" might return just a bit later from the /sys/class/powersupply/BAT0/status path, than the last event is received. For my setup, this will result in a "Plugged in" (but not charging) state :(

When implementing some sleep(1) this race condition does not occur anymore, but this cannot be a solution.

schmop avatar Jul 26 '24 23:07 schmop

Might also Closes #3726 Closes #3603 Closes #3471

schmop avatar Nov 27 '24 01:11 schmop

Hi, this looks awesome. @Alexays would you consider accepting this PR?

Jajasek avatar Jan 24 '25 18:01 Jajasek

LGTM.

Alexays avatar Jan 25 '25 08:01 Alexays

Reverted, FreeBSD is failing.

Alexays avatar Jan 25 '25 08:01 Alexays