diff --git a/bin/omarchy-provision-first-run b/bin/omarchy-provision-first-run index ccb650b4..9b7fa761 100755 --- a/bin/omarchy-provision-first-run +++ b/bin/omarchy-provision-first-run @@ -83,7 +83,7 @@ run_first_run_step "apply speaker tuning" \ bash "$OMARCHY_PATH/install/user/first-run/audio-tuning.sh" omarchy-notification-wait || log_first_run "Timed out waiting for notification service; continuing" -run_first_run_step "show Wi-Fi/update notifications" \ +run_first_run_step "schedule Wi-Fi/update notifications" \ bash "$OMARCHY_PATH/install/user/first-run/wifi.sh" # Waits for the menu to be answered, so it goes last and leaves the toasts # waiting underneath. diff --git a/docs/file-layout.md b/docs/file-layout.md index 0acf54c9..b7b78074 100644 --- a/docs/file-layout.md +++ b/docs/file-layout.md @@ -238,7 +238,8 @@ systemd instance: `install/user/first-run/gtk-primary-paste.sh` — GNOME/GTK settings that need the dconf daemon. - `install/user/first-run/wifi.sh` — Wi-Fi/update toasts (waits for a live - notification server before firing). + notification server before firing, then waits detached on `nm-online` so the + update prompt only lands once there is a connection). - `install/user/first-run/keybindings.sh` — opens the keybindings menu to greet the first login; blocks until it is answered. diff --git a/install/user/first-run/wifi.sh b/install/user/first-run/wifi.sh index 4d961be9..0a6e6b4b 100644 --- a/install/user/first-run/wifi.sh +++ b/install/user/first-run/wifi.sh @@ -1,5 +1,5 @@ notify_update() { - omarchy-notification-send -u critical -g  "Update System" "$1" \ + omarchy-notification-send -u critical -g "Update System" "Click to update the system." \ --exec "omarchy-launch-floating-terminal-with-presentation omarchy-update" } @@ -8,10 +8,23 @@ notify_wifi() { --exec "omarchy-shell shell toggle omarchy.network" } -if ! ping -c3 -W1 1.1.1.1 >/dev/null 2>&1; then - # Newest stacks on top, and Wi-Fi is what you need first, so send it last. - notify_update "When you have internet, click to update the system." - notify_wifi -else - notify_update "Click to update the system." -fi +announce_network() { + # Ethernet is still negotiating DHCP when the session starts, so probing + # right away calls a working machine offline. NetworkManager reports startup + # complete once it has tried every connection it could auto-activate, which + # is the first moment the answer means anything. + nm-online -q -s -t 30 + + # -x takes that answer as it stands rather than waiting out the timeout, so + # a laptop with nothing to connect to gets prompted immediately. + if ! nm-online -q -x -t 30; then + notify_wifi + # Nothing to update against until a link lands, so hold that prompt. + nm-online -q -t 3600 || return + fi + + notify_update +} + +# Detached, so a slow or absent connection never holds up the rest of first run. +announce_network &