Some checks failed
Check / eval (push) Has been cancelled
The machine flake's git-tracked settings file is system state, not "theme" only — rename it to state.json. CLI becomes nomarchy-state-sync with a nomarchy-theme-sync symlink for scripts and muscle memory. Eval (mkFlake, doctor, lifecycle) still accepts theme-state.json; the next write migrates to state.json and removes the legacy file. Documented in MIGRATION.md; drop the CLI alias after release notes.
54 lines
1.8 KiB
Bash
54 lines
1.8 KiB
Bash
# nomarchy-first-boot — one-shot "you're set" toast on the first session.
|
||
# Marker is settings.firstBootShown in the flake's state.json
|
||
# (in-checkout state; never ~/.local/state). notify-send and
|
||
# nomarchy-state-sync come from PATH so the VM check can shim them.
|
||
|
||
# Live ISO already has its own welcome (hosts/live.nix); skip there so
|
||
# users aren't double-toasted and the live seed doesn't get a sticky
|
||
# firstBootShown write every boot.
|
||
# uname -n is coreutils; avoid depending on a separate hostname package.
|
||
hn=$(uname -n 2>/dev/null || true)
|
||
if [ "$hn" = nomarchy-live ]; then
|
||
exit 0
|
||
fi
|
||
|
||
# Already shown → silent. Missing key / no checkout → treat as not shown
|
||
# (state-sync get exits non-zero when the key is absent).
|
||
shown=$(nomarchy-state-sync get settings.firstBootShown 2>/dev/null || true)
|
||
case "$shown" in
|
||
true|1|yes) exit 0 ;;
|
||
esac
|
||
|
||
# Wait for the notification daemon (swaync). On first login the unit can
|
||
# race graphical-session and get "Timeout was reached" from D-Bus — then
|
||
# either no toast, or a toast that never lands while we still write the
|
||
# marker. Retry notify-send; only persist the marker after a success.
|
||
body="SUPER+M menu · SUPER+T themes · SUPER+? keys
|
||
Wi‑Fi: System › Network (or the bar tray)
|
||
Anything off? System › Doctor"
|
||
|
||
ok=
|
||
i=0
|
||
while [ "$i" -lt 8 ]; do
|
||
if notify-send -a Nomarchy -u normal -t 0 \
|
||
"You're set" \
|
||
"$body"; then
|
||
ok=1
|
||
break
|
||
fi
|
||
i=$((i + 1))
|
||
sleep 2
|
||
done
|
||
|
||
if [ -z "$ok" ]; then
|
||
# Leave firstBootShown alone so the next login can try again.
|
||
exit 1
|
||
fi
|
||
|
||
# Persist in the checkout so re-login is silent. --no-switch: marker only.
|
||
if ! nomarchy-state-sync --quiet set settings.firstBootShown true --no-switch; then
|
||
# No writable flake checkout (or tool missing) — still showed the toast;
|
||
# without a marker it may reappear next login. Don't fail the unit.
|
||
exit 0
|
||
fi
|