From 4963022c108f8bce81f8e324e1b55c7d8e9e2675 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Sun, 8 Nov 2026 10:47:37 +0200 Subject: [PATCH] Keep the status bar clock minute-accurate, including while the panel is dark - Add a lightweight statusbar_clock job (sxmo_run_aligned.sh 60 running sxmo_hook_statusbar.sh time) to all three sxmo_hook_start.sh copies while the heavier statusbar_periodics loop stays at 300 s. - Let the time action refresh 099-time even when the screen is blanked; only the xsetroot publish remains gated by ! is_screen_dark, so the native desktop clock is redrawn as soon as the panel wakes. - Guard the job and the time action in check-rebuild.sh, update AGENTS, MANUAL and the a1108 changelog, redeploy to the connected phone and rebuild the a1108 / dejavu image. --- AGENTS.md | 2 +- CHANGELOG.md | 9 +++++++++ MANUAL.md | 2 +- .../skel/.config/sxmo/hooks/sxmo_hook_start.sh | 6 ++++++ .../user/.config/sxmo/hooks/sxmo_hook_start.sh | 6 ++++++ .../share/sxmo/default_hooks/sxmo_hook_start.sh | 6 ++++++ .../sxmo/default_hooks/sxmo_hook_statusbar.sh | 6 ++++-- scripts/check-rebuild.sh | 16 ++++++++++++++++ 8 files changed, 49 insertions(+), 4 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 0f13926..887a7b7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -76,7 +76,7 @@ Sync net time** (`src/sxmo-dmenu/dmenu.c` + `usr/bin/bananarchy-sync-net-time.sh`) forces the same burst manually and notifies the user, and the helper's `sync` mode reports the result. Keep DNS resolution outside the helper's `flock` so a long boot retry cannot swallow -network-up events, and keep `var/lib/chrony` owned by the `chrony` user. Network state changes are event-driven through `etc/NetworkManager/dispatcher.d/30-bananarchy-network-status.sh` + `usr/bin/bananarchy-network-event.sh`; keep `superctl disable sxmo_networkmonitor` in the session start hooks, and never reintroduce `superctl start sxmo_networkmonitor` or a long-lived `nmcli device monitor`. The status bar clock must be refreshed synchronously on unlock (`sxmo_hook_unlock.sh`) and by dmenu's `update_t9_status_indicator()` before `XStoreName()`; `sxmo_hook_statusbar.sh` forces a root-name refresh on `time` / `state_change`, and its `battery` and `refresh` actions republish the charge icon together with a fresh clock (`bananarchy-time-sync.sh` calls `refresh` after an NTP clock step). `postmarketos-zram-swap` uses `/usr/bin/zramstart`, not `/etc/conf.d/zram-init`: keep `deviceinfo_zram_swap_algo="lz4"` in every `devices/*/deviceinfo*` file. Keep `vm.compaction_proactiveness=0` in `etc/sysctl.d/99-bananarchy-power.conf` and `etc/local.d/10-power-save.start`; see `BATTERY-OPTIMIZATION-ANALYSIS.md` §17 and §18. Deep standby is `bananarchy-suspend.sh` / `bananarchy-deep-standby.sh` / `sxmo_autosuspend.sh` / `sxmo_suspend.sh`, gated by `/etc/bananarchy-no-deep-standby` (shipped present = disabled) and inert because `CONFIG_SUSPEND` is off. A full custom module tree rebuild is deliberately **not** planned: this firmware has no PSCI `SYSTEM_SUSPEND`, so `CONFIG_SUSPEND` would only give s2idle (`freeze`), not `mem` / DDR self-refresh, for <1 mA of saving (see `BATTERY-OPTIMIZATION-ANALYSIS.md` §14 and §17). Never force `sxmo.noidle`/`sxmo.nosuspend` from the session scripts and never reintroduce the infinite `sxmo_not_suspendable` wakelock. `/etc/bananarchy/` is root-only. +network-up events, and keep `var/lib/chrony` owned by the `chrony` user. Network state changes are event-driven through `etc/NetworkManager/dispatcher.d/30-bananarchy-network-status.sh` + `usr/bin/bananarchy-network-event.sh`; keep `superctl disable sxmo_networkmonitor` in the session start hooks, and never reintroduce `superctl start sxmo_networkmonitor` or a long-lived `nmcli device monitor`. The status bar clock must be refreshed synchronously on unlock (`sxmo_hook_unlock.sh`), by dmenu's `update_t9_status_indicator()` before `XStoreName()`, and every minute by the `statusbar_clock` aligned job in the session start hooks; `sxmo_hook_statusbar.sh` forces a root-name refresh on `time` / `state_change`, and its `battery` and `refresh` actions republish the charge icon together with a fresh clock (`bananarchy-time-sync.sh` calls `refresh` after an NTP clock step). `postmarketos-zram-swap` uses `/usr/bin/zramstart`, not `/etc/conf.d/zram-init`: keep `deviceinfo_zram_swap_algo="lz4"` in every `devices/*/deviceinfo*` file. Keep `vm.compaction_proactiveness=0` in `etc/sysctl.d/99-bananarchy-power.conf` and `etc/local.d/10-power-save.start`; see `BATTERY-OPTIMIZATION-ANALYSIS.md` §17 and §18. Deep standby is `bananarchy-suspend.sh` / `bananarchy-deep-standby.sh` / `sxmo_autosuspend.sh` / `sxmo_suspend.sh`, gated by `/etc/bananarchy-no-deep-standby` (shipped present = disabled) and inert because `CONFIG_SUSPEND` is off. A full custom module tree rebuild is deliberately **not** planned: this firmware has no PSCI `SYSTEM_SUSPEND`, so `CONFIG_SUSPEND` would only give s2idle (`freeze`), not `mem` / DDR self-refresh, for <1 mA of saving (see `BATTERY-OPTIMIZATION-ANALYSIS.md` §14 and §17). Never force `sxmo.noidle`/`sxmo.nosuspend` from the session scripts and never reintroduce the infinite `sxmo_not_suspendable` wakelock. `/etc/bananarchy/` is root-only. - **Image residue**: `rebuild-image.sh` strips `/var/cache/apk`, all `apk.log*` files, and unused gettext locale trees before `mke2fs` and aborts the build if any apk cache/log remains; never add an `apk` call after that guard. - **No on-device compiler**: `scripts/rootfs-packages.txt` ships no `gcc`/`g++`/`musl-dev`/`make` and no Janet runtime (`janet`, `janet-dev`, `jpm`); cross-compile native code with `scripts/build-*.sh`. On-device development uses the Yabasic FFI SDK (`neoui.yab` / `neonet.yab`), which requires `yabasic`, `libffi`, `libneoui.so`, and `libcurl.so.4` — never remove those. `scripts/check-rebuild.sh` guards both sides. - **Core tools**: `curl`, `bc`, `ed`, `rlwrap`, `mandoc`, `nano`, `less`, and `frotz` are pinned core tools asserted by `scripts/check-rebuild.sh`. Perl, Lua, optional Tcl extensions, and the `sqlite` CLI are excluded, while `tcl`, `python3`, `bash`, `luajit`, `gawk`, `jq`, `gojq`, and `quickjs` remain as hard runtime dependencies. diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b6fd60..5c85163 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,15 @@ release metadata are generated by `scripts/version.sh` as `a1108` / `dejavu`. after a successful NTP burst, republishing the clock and charge icon immediately when `chronyd` steps the clock instead of waiting for the next 300 s periodic tick. `scripts/check-rebuild.sh` guards all four paths. +- **Minute-accurate status bar clock**: the full `statusbar_periodics` loop + stays at 300 s (no extra modem or NetworkManager polls), but a lightweight + `statusbar_clock` job now runs `sxmo_hook_statusbar.sh time` through + `sxmo_run_aligned.sh 60` at minute boundaries. The `time` action refreshes + `099-time` even while the panel is dark (only the `xsetroot` publish stays + gated), so the clock is current at unlock and dmenu reads the right value; + redrawing the root name also refreshes the native desktop clock. All three + `sxmo_hook_start.sh` copies were updated and `scripts/check-rebuild.sh` + guards the job. - **Live phone updated and verified**: network time was synced on the connected device (the RTC had fallen back to 1970, which also broke TLS certificate validation), all installed packages were refreshed with diff --git a/MANUAL.md b/MANUAL.md index d434804..5cf82bb 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -23,7 +23,7 @@ This manual covers flashing, operating, and customizing **Bananarchy Linux** (`2 ### 1.3 Core architecture highlights 1. **Pure X11 (`Xlibre` + `sxmo-de-dwm`) for `240x320` QVGA displays**: - Uses a lightweight cross-compiled **Xlibre** server with `modesetting` KMS, partial-rectangle `ShadowFB` SPI updates, and zero Wayland overhead. - - **Patched `dwm`** provides a `240x320` vertical bottom-stack (`bstack`) layout, a 24px top status bar, a transparent `"Menu"` / `"Names"` desktop softkey bar, a native `ParentRelative` desktop datetime overlay (`Fira Code` 32pt `%H:%M` and 14pt `%a %d %b %Y` with 1px drop shadow, rendered directly by `dwm` with zero external Conky process overhead and automatic live timezone/wallpaper refresh), and `< 2 ms` handling of physical slider (`SW_LID`) and wake keys. The status bar clock is refreshed synchronously on unlock and whenever dmenu updates its input-method indicator, so it cannot keep showing a pre-lock time after the panel wakes. Network state changes are handled by the NetworkManager dispatcher instead of a long-lived `nmcli device monitor`, so connectivity stays immediate without an idle poller. + - **Patched `dwm`** provides a `240x320` vertical bottom-stack (`bstack`) layout, a 24px top status bar, a transparent `"Menu"` / `"Names"` desktop softkey bar, a native `ParentRelative` desktop datetime overlay (`Fira Code` 32pt `%H:%M` and 14pt `%a %d %b %Y` with 1px drop shadow, rendered directly by `dwm` with zero external Conky process overhead and automatic live timezone/wallpaper refresh), and `< 2 ms` handling of physical slider (`SW_LID`) and wake keys. The status bar clock is refreshed synchronously on unlock, whenever dmenu updates its input-method indicator, and every minute by a lightweight aligned job (the heavier status bar periodics stay at 300 s). Its status file is kept current even while the panel is blanked, so it cannot keep showing a pre-lock time after the panel wakes. Network state changes are handled by the NetworkManager dispatcher instead of a long-lived `nmcli device monitor`, so connectivity stays immediate without an idle poller. 2. **Preloaded resident DWM plugins (`< 2 ms` wakeup)**: - Core phone applications (`dmenu`, `xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `passcode`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`, `sip`, `email`, `irc`, `tox`, `smallweb`, `webarchy`, `gps`, `privacy`, `engmenu`, `locker`) run as preloaded resident daemons (`dwm-plugin --preload`) that sleep at 0% CPU and open instantaneously over FIFO/socket IPC. - All UI elements — including the `dunst` notification daemon (`bananarchy-sync-dunst-theme`) — share the **NeoUI SDK (`libneoui.so` + `/usr/include/neoui.h`)** and a single **XRDB theming engine** (`~/.xthemes/*.xth` -> `~/.Xresources`) with 21 preinstalled color schemes, proportional font sizing (`theme.baseFontSize`), and live reload without restarting X11. NeoUI exposes both C++20 classes and a C-compatible FFI (`neoui_*`) for building custom native or scripted (`yabasic` via `~/Projects/neoui.yab`, `~/Projects/neoui_demo.yab`, and `~/Projects/bulls_cows.yab`, paired with **NeoNet** in `~/Projects/neonet.yab` and `~/Projects/neonet_demo.yab` for `libcurl` HTTP/HTTPS and TCP/TLS/UDP socket networking) `240x320` GUI applications — see [SDK.md](./SDK.md) for the complete API reference and examples. diff --git a/overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_start.sh b/overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_start.sh index 11df708..1290dc6 100755 --- a/overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_start.sh +++ b/overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_start.sh @@ -73,6 +73,12 @@ sxmo_hook_statusbar.sh all sxmo_jobs.sh start statusbar_periodics sxmo_run_aligned.sh 300 \ sxmo_hook_statusbar.sh periodics +# Refresh the status bar clock every minute. xsetroot also redraws the native +# desktop clock, while the heavier modem/network periodics stay at 300 s and +# the time action exits immediately while the panel is dark. +sxmo_jobs.sh start statusbar_clock sxmo_run_aligned.sh 60 \ + sxmo_hook_statusbar.sh time + # dunst is required for warnings. /usr/bin/bananarchy-sync-dunst-theme --no-restart >/dev/null 2>&1 || true superctl start dunst diff --git a/overlay/rootfs/home/user/.config/sxmo/hooks/sxmo_hook_start.sh b/overlay/rootfs/home/user/.config/sxmo/hooks/sxmo_hook_start.sh index 5b95204..8c1cb07 100755 --- a/overlay/rootfs/home/user/.config/sxmo/hooks/sxmo_hook_start.sh +++ b/overlay/rootfs/home/user/.config/sxmo/hooks/sxmo_hook_start.sh @@ -73,6 +73,12 @@ sxmo_hook_statusbar.sh all sxmo_jobs.sh start statusbar_periodics sxmo_run_aligned.sh 300 \ sxmo_hook_statusbar.sh periodics +# Refresh the status bar clock every minute. xsetroot also redraws the native +# desktop clock, while the heavier modem/network periodics stay at 300 s and +# the time action exits immediately while the panel is dark. +sxmo_jobs.sh start statusbar_clock sxmo_run_aligned.sh 60 \ + sxmo_hook_statusbar.sh time + # dunst is required for warnings. /usr/bin/bananarchy-sync-dunst-theme --no-restart >/dev/null 2>&1 || true superctl start dunst diff --git a/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_start.sh b/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_start.sh index 1c6062b..06b1aa5 100755 --- a/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_start.sh +++ b/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_start.sh @@ -81,6 +81,12 @@ sxmo_hook_statusbar.sh all sxmo_jobs.sh start statusbar_periodics sxmo_run_aligned.sh 300 \ sxmo_hook_statusbar.sh periodics +# Refresh the status bar clock every minute. xsetroot also redraws the native +# desktop clock, while the heavier modem/network periodics stay at 300 s and +# the time action exits immediately while the panel is dark. +sxmo_jobs.sh start statusbar_clock sxmo_run_aligned.sh 60 \ + sxmo_hook_statusbar.sh time + # dunst is required for warnings. /usr/bin/bananarchy-sync-dunst-theme --no-restart >/dev/null 2>&1 || true superctl start dunst diff --git a/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_statusbar.sh b/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_statusbar.sh index c6fdadf..1aa8fde 100755 --- a/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_statusbar.sh +++ b/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_statusbar.sh @@ -518,8 +518,10 @@ case "$1" in force_bar=1 ;; time) - is_screen_dark && exit 0 - set_time 1 + # Keep the status file current even while the panel is dark: the final + # xsetroot publish below is still gated by ! is_screen_dark, so the + # desktop clock is redrawn as soon as the screen wakes. + set_time force_bar=1 ;; modem|volume) diff --git a/scripts/check-rebuild.sh b/scripts/check-rebuild.sh index fa05219..fe48f96 100755 --- a/scripts/check-rebuild.sh +++ b/scripts/check-rebuild.sh @@ -327,10 +327,15 @@ echo "[check] Status bar charge icon and clock refresh..." BATTERY_HOOK="$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_battery.sh" TIME_SYNC="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-time-sync.sh" BATTERY_CASE="$(sed -n '/^ battery)/,/^ ;;/p' "$STATUS_HOOK")" +TIME_CASE="$(sed -n '/^ time)/,/^ ;;/p' "$STATUS_HOOK")" if ! printf '%s\n' "$BATTERY_CASE" | grep -q 'set_time' || \ ! printf '%s\n' "$BATTERY_CASE" | grep -q 'force_bar=1'; then fail "battery events no longer republish the charge icon and clock" fi +if ! printf '%s\n' "$TIME_CASE" | grep -q 'set_time' || \ + printf '%s\n' "$TIME_CASE" | grep -q 'is_screen_dark && exit'; then + fail "time action no longer keeps the clock file current while dark" +fi if ! grep -q '^ refresh)' "$STATUS_HOOK" || \ ! grep -q 'refresh_statusbar' "$TIME_SYNC"; then fail "post-sync status bar refresh is missing" @@ -341,6 +346,17 @@ fi if ! grep -q 'rm -f "$ICON_FILE"' "$BATTERY_HOOK"; then fail "forced battery refresh no longer republishes an unchanged charge icon" fi +for f in "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_start.sh" \ + "$BASE_DIR/overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_start.sh" \ + "$BASE_DIR/overlay/rootfs/home/user/.config/sxmo/hooks/sxmo_hook_start.sh"; do + if ! grep -q 'statusbar_clock' "$f" || \ + ! grep -q 'sxmo_run_aligned.sh 60' "$f"; then + fail "${f#$BASE_DIR/} no longer refreshes the clock every minute" + fi + if ! sh -n "$f" 2>/dev/null; then + fail "shell syntax: ${f#$BASE_DIR/}" + fi +done for f in "$BATTERY_HOOK" "$TIME_SYNC" "$STATUS_HOOK"; do if ! sh -n "$f" 2>/dev/null; then fail "shell syntax: ${f#$BASE_DIR/}"