Refresh the charge icon immediately on charger plug/unplug

This commit is contained in:
Luxferre committed 2026-11-10 13:00:41 +02:00
1 parent 6a6222c198
commit eaf08abcd4
9 files changed
+159 -6

No files matched your search

@@ -1,5 +1,11 @@
# Bananarchy battery/charger statusbar hook (U4).
# Only the two PM8916 supplies exist on these devices; filtering avoids
# spawning a shell for unrelated power_supply change events.
# Only the PM8916 supplies exist on these devices; filtering avoids spawning a
# shell for unrelated power_supply change events.
SUBSYSTEM=="power_supply", ACTION=="change", KERNEL=="pm8916-bms-vm", RUN+="/bin/sh -c 'DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/10000 /usr/share/sxmo/default_hooks/sxmo_hook_battery.sh udev >/dev/null 2>&1 &'"
SUBSYSTEM=="power_supply", ACTION=="change", KERNEL=="pm8916-lbc-chgr", RUN+="/bin/sh -c 'DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/10000 /usr/share/sxmo/default_hooks/sxmo_hook_battery.sh udev >/dev/null 2>&1 &'"
# A VBUS plug/unplug changes the charger's online attribute, not necessarily
# the reported capacity. Force the charge icon immediately and re-read sysfs
# after the short race window so the icon actually changes at that moment.
SUBSYSTEM=="power_supply", ACTION=="change", KERNEL=="pm8916-lbc-chgr", RUN+="/bin/sh -c 'DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/10000 /usr/bin/bananarchy-battery-charge-event.sh >/dev/null 2>&1 &'"
# Some PM8916 firmware revisions publish the VBUS transition on a separate
# USB/Mains supply instead of the charger node.
SUBSYSTEM=="power_supply", ACTION=="change", ENV{POWER_SUPPLY_ONLINE}=="0|1", KERNEL!="pm8916-bms-vm", RUN+="/bin/sh -c 'DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/10000 /usr/bin/bananarchy-battery-charge-event.sh >/dev/null 2>&1 &'"