Skip to content

Commit c992cdf

Browse files
dhhclaude
andcommitted
Restart the shell unconditionally after every update
Updates routinely replace the shell's QML, and a stale process can lazy-load new files into old code. Restarting at the end of every omarchy update removes the need for migrations to restart the shell or defer one with the restart-shell-required marker: the login-time migration path already runs a fresh shell that hot-reloads shell.json. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 72ffd58 commit c992cdf

8 files changed

Lines changed: 16 additions & 21 deletions

File tree

‎bin/omarchy-update-restart‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,9 @@ for file in "$HOME"/.local/state/omarchy/restart-*-required; do
4242
omarchy-restart-"$service"
4343
fi
4444
done
45+
46+
# Updates routinely replace the shell's QML, and a stale process can lazy-load
47+
# new files into old code. A restart failure (locked session, ssh, TTY) only
48+
# prints its reason: the next update or login gets a fresh shell anyway.
49+
echo "Restarting shell"
50+
omarchy-restart-shell || true

‎docs/migrations.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ New migration format:
127127
- Use helper commands such as `omarchy-cmd-present`, `omarchy-cmd-missing`,
128128
`omarchy-pkg-add`, `omarchy-pkg-drop`, `omarchy-pkg-present`, and
129129
`omarchy-pkg-missing` when appropriate.
130+
- Never restart the Omarchy shell. `omarchy update` restarts it unconditionally
131+
after migrations run, and the login-time shell already runs current code and
132+
hot-reloads `shell.json` edits.
130133

131134
Example:
132135

‎docs/update-process.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The design goal is:
2626
| `~/.local/state/omarchy/current/` | user | Generated active theme, selected theme name, and current background symlink. |
2727
| `~/.local/state/omarchy/migrations/` | user | Per-user migration markers. |
2828
| `~/.local/state/omarchy/reboot-required` | user | Optional reboot marker checked by `omarchy-update-restart`. |
29-
| `~/.local/state/omarchy/restart-*-required` | user | Optional service/app restart markers checked by `omarchy-update-restart`. |
29+
| `~/.local/state/omarchy/restart-*-required` | user | Optional service/app restart markers checked by `omarchy-update-restart`. The shell needs no marker: it is restarted unconditionally after every update. |
3030

3131
## Migration layout
3232

@@ -261,7 +261,7 @@ scripts.
261261
| `omarchy-update-mise` | Runs `mise up` for mise-managed tools. | **Keep.** Mise-managed tools are intentionally part of the blessed update path. |
262262
| `omarchy-update-orphan-pkgs` | Lists orphans and prompts before removal; noninteractive mode never removes. | **Keep for now.** Safe because it is prompt-only. |
263263
| `omarchy-update-analyze-logs` | Scans `/tmp/omarchy-update.log` for known failure patterns, currently initramfs generation. | **Keep/expand.** Useful safety net; should grow only for high-signal checks. |
264-
| `omarchy-update-restart` | Prompts for reboot after kernel/Hyprland updates and restarts components with `restart-*-required` markers. | **Keep.** Important final step; may eventually include service-restart checks. |
264+
| `omarchy-update-restart` | Prompts for reboot after kernel/Hyprland updates, restarts components with `restart-*-required` markers, and always restarts the shell. | **Keep.** Important final step; may eventually include service-restart checks. |
265265
| `omarchy-update-firmware` | Manual firmware update command using fwupd. Not part of the normal update pipeline. | **Keep separate.** Firmware is not a routine system update step. |
266266
| `omarchy-update-time` | Restarts `systemd-timesyncd`. | **Question.** Not really an update command. Consider renaming/moving under system/time maintenance. |
267267

‎migrations/1784672586.sh‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ if ! omarchy-pkg-present quickshell-git; then
55
# quickshell package in place; packages depending on quickshell stay
66
# satisfied through the provides.
77
sudo pacman -S --noconfirm --ask 4 quickshell-git
8-
omarchy-state set restart-shell-required
98
fi

‎migrations/1784989000.sh‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,3 @@ if [[ -s $config_file ]]; then
3737
.bar.layout.center |= place_indicators_before_clock
3838
' "$config_file" >"$tmp" && mv "$tmp" "$config_file" || rm -f "$tmp"
3939
fi
40-
41-
omarchy-restart-shell

‎migrations/1785189600.sh‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,3 @@ if [[ -s $config_file ]] && grep -q 'TmuxAlert' "$config_file"; then
118118

119119
rm -f "$tmp"
120120
fi
121-
122-
# Nothing to restart from a TTY or over ssh, and that is no reason to stop the
123-
# rest of the queue: hand it to the post-update restart instead.
124-
omarchy-restart-shell >/dev/null 2>&1 || omarchy-state set restart-shell-required

‎migrations/1785344985.sh‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,3 @@ if [[ -s $config_file ]] && omarchy-cmd-present jq; then
4545
end
4646
' "$config_file" >"$tmp" && mv "$tmp" "$config_file" || rm -f "$tmp"
4747
fi
48-
49-
omarchy-restart-shell

‎test/shell.d/tmux-alert-removal-migration-test.sh‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,8 @@ pass "alert removal handles the older indicators key"
234234
fail "alert removal leaves an already-empty list alone" "$(jq -c '.bar.layout.right[1]' "$shell_config")"
235235
pass "alert removal leaves an already-empty list alone"
236236

237-
(($(wc -l <"$SHELL_RESTARTS") == 1)) || fail "alert removal restarts the shell"
238-
[[ ! -s $STATE_CALLS ]] || fail "a restarted shell needs no deferred restart" "$(cat "$STATE_CALLS")"
239-
pass "alert removal restarts the shell"
240-
241-
# Migrations run from a TTY or over ssh have no shell to restart, and stopping
242-
# there would strand every migration queued behind this one.
243-
reset_home
244-
SHELL_RESTART_STATUS=1 run_migration
245-
grep -Fxq 'set restart-shell-required' "$STATE_CALLS" || fail "an unavailable shell defers its restart" "$(cat "$STATE_CALLS")"
246-
pass "an unavailable shell defers its restart"
237+
# The running shell hot-reloads shell.json and the post-update restart is
238+
# unconditional, so the migration itself never touches the shell.
239+
[[ ! -s $SHELL_RESTARTS ]] || fail "alert removal leaves shell restarts to the update" "$(cat "$SHELL_RESTARTS")"
240+
[[ ! -s $STATE_CALLS ]] || fail "alert removal defers no shell restart" "$(cat "$STATE_CALLS")"
241+
pass "alert removal leaves shell restarts to the update"

0 commit comments

Comments
 (0)