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 -1
View File
@@ -617,7 +617,7 @@ The **Xlibre** display server (`modesetting_drv.so`) uses **Glamor + DRI3 + GLX
`chronyd` runs from the default runlevel with `pool pool.ntp.org iburst minpoll 12 maxpoll 16`: long polls keep Wi-Fi asleep, while `iburst` sets the clock within seconds whenever the pool resolves. Because NetworkManager installs `resolv.conf` after `chronyd` starts, a `bananarchy-time-sync` OpenRC service and `/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh` re-resolve the pool and request an immediate burst when a connection comes up (`up`, `dhcp4-change`, `dhcp6-change`, `dns-change`, `connectivity-change`, `vpn-up`). The helper uses chronyd's root-only Unix command socket, so `cmdport 0` keeps the UDP command port closed, and it throttles repeats with a monotonic uptime stamp so a decades-long clock step cannot confuse it. `/var/lib/chrony` is owned by the `chrony` user so the driftfile survives reboots.
If the clock is still wrong after a connection comes up, use **Config -> Sync net time**. It runs `bananarchy-sync-net-time.sh`, forces an immediate burst over the same Unix socket, and shows a notification with the synced UTC date or a failure message. This is also handy after a long offline period, when the RTC has fallen back to 1970. After a confirmed sync, the helper calls `sxmo_hook_statusbar.sh refresh` as the X session user, so the status bar clock and charge icon are republished immediately instead of waiting for the next 300 s periodic tick. Charge events likewise refresh both the charge icon and the clock, and unlock forces a charge icon refresh even if the backlight is not yet bright.
If the clock is still wrong after a connection comes up, use **Config -> Sync net time**. It runs `bananarchy-sync-net-time.sh`, forces an immediate burst over the same Unix socket, and shows a notification with the synced UTC date or a failure message. This is also handy after a long offline period, when the RTC has fallen back to 1970. After a confirmed sync, the helper calls `sxmo_hook_statusbar.sh refresh` as the X session user, so the status bar clock and charge icon are republished immediately instead of waiting for the next 300 s periodic tick. Charge events likewise refresh both the charge icon and the clock, and unlock forces a charge icon refresh even if the backlight is not yet bright. Plugging or unplugging the USB cable is handled by `85-bananarchy-battery.rules` and `/usr/bin/bananarchy-battery-charge-event.sh`: the charger's `power_supply` uevent forces the icon immediately and once more after a two-second sysfs race window (with `flock` coalescing the burst of uevents), so the charge icon changes at the moment of the transition even when the reported capacity has not changed yet.
```bash
bananarchy-time-sync.sh status # chronyc tracking + sources (via doas)