From e2738f2ab46694f4fb1f9493e3626815509a4446 Mon Sep 17 00:00:00 2001 From: rootiest Date: Sat, 6 Jun 2026 22:57:45 -0400 Subject: [PATCH] feat: add first_run.fish for one-time shell initialization --- conf.d/first_run.fish | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 conf.d/first_run.fish diff --git a/conf.d/first_run.fish b/conf.d/first_run.fish new file mode 100644 index 0000000..a81424d --- /dev/null +++ b/conf.d/first_run.fish @@ -0,0 +1,45 @@ +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +# ╭──────────────────────────────────────────────────────────╮ +# │ First-Run Initialization │ +# ╰──────────────────────────────────────────────────────────╯ +# +# Runs exactly once on the first interactive fish session after install. +# To reset for testing, run: set -Ue __fish_config_first_run_complete + +# Exit early in non-interactive shells (scripts, completions, subshells) +if not status is-interactive + return +end + +# Skip if this shell has already been initialized +if set -q __fish_config_first_run_complete + return +end + +# Set the flag immediately — before actions — so a mid-run crash doesn't +# leave the shell in a state that re-triggers everything next session. +set -U __fish_config_first_run_complete 1 + +# ──────────────────────────── Welcome message ─────────────────────────── +echo "" +echo " Welcome to your fish shell configuration!" +echo " Run 'config-help' for offline documentation." +echo " Run 'fish-deps' to check and install dependencies." +echo "" + +# ──────────────────────────── Bootstrap Fisher ────────────────────────── +if not type -q fisher + echo " [first-run] Installing Fisher plugin manager..." + if curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source + and fisher update 2>/dev/null + echo " [first-run] Fisher installed and plugins loaded." + else + echo " [first-run] Fisher install failed — run 'fisher update' manually." >&2 + end +end + +# ───────────────────────────── Apply theme ────────────────────────────── +# Catppuccin Mocha theme ships with this config in themes/; it is always available. +fish_config theme choose "Catppuccin Mocha" 2>/dev/null