bos/iso/airootfs/usr/local/bin/bos-welcome
Breadway d78a2343f4
All checks were successful
Mirror to GitHub / mirror (push) Successful in 2s
Build and publish package / package (push) Successful in 2m2s
Build and release ISO / release-iso (push) Successful in 14m20s
Fix boot-critical, session, and UX bugs found in round-3 UX audit
Snapshots panel was non-functional (wrong snapper flag); breadgreet picked
the wrong session .desktop and skipped bos-session's PATH fixup; Calamares
aborted offline installs over an unnecessary packages module; snapshot
rollback silently no-op'd on BOS's pinned-subvolume layout (now points at
grub-btrfs instead); breadcrumbs was configurable but had no daemon to run
it. Also: SUPER+I double-bind, breadpaper/packages panels blocking the GTK
main thread, dead polkit rule, and a sweep of smaller drift (default
sidebar view, stale wording, missing .desktop launchers, wallpaper daemon
not recording its own default).
2026-07-03 22:04:26 +08:00

48 lines
2.2 KiB
Bash

#!/bin/bash
# First-run welcome + first-run/every-login network check. Launched from the
# Hyprland autostart; the bos-welcome window class is floated/centred by a
# Hyprland window rule.
set -u
# Never run in the live/installer session — only on an installed system.
[[ "$(id -un)" == "liveuser" ]] && exit 0
welcomed_marker="${XDG_CONFIG_HOME:-$HOME/.config}/bos/.welcomed"
mkdir -p "$(dirname "$welcomed_marker")"
# Network check. A fresh install usually boots with no connection (Wi-Fi
# isn't configured during install), and the first `bos-update`/pacman run
# then fails with confusing DNS/"could not resolve host" errors. If
# NetworkManager reports we're not fully online, open nmtui so the user can
# join a network before anything else. This runs on EVERY login, not just
# the first, and isn't gated by any marker — it keeps re-prompting until the
# machine is actually online, then naturally stops (the "full" check below
# short-circuits). Best-effort: missing nmcli/nmtui/kitty, or the user
# quitting nmtui, must never block the welcome text below.
if command -v nmcli &>/dev/null; then
conn="$(nmcli networking connectivity check 2>/dev/null)"
# NetworkManager may still be associating right at compositor start —
# give it a few short retries before concluding we're actually offline,
# so a machine with working Wi-Fi doesn't get a spurious nmtui popup.
tries=0
while [[ "$conn" != "full" && "$tries" -lt 3 ]]; do
sleep 1
conn="$(nmcli networking connectivity check 2>/dev/null)"
tries=$((tries + 1))
done
if [[ "$conn" != "full" ]]; then
notify-send -u normal "BOS" "No internet yet — opening network setup so updates work." 2>/dev/null || true
if command -v nmtui &>/dev/null; then
kitty --class bos-netsetup --title "Connect to a network" -- nmtui connect 2>/dev/null || true
fi
fi
fi
# Welcome text: shown once ever, independent of network status above (an
# offline machine still gets useful onboarding text — it just also keeps
# getting the network prompt on future logins until it connects).
[[ -f "$welcomed_marker" ]] && exit 0
touch "$welcomed_marker"
exec kitty --class bos-welcome --title "Welcome to BOS" -- less -R /usr/share/bos/welcome.txt