Add seasonal palettes and selection prompts

- Implement dynamic/static season support in shared PS1

- Add season selection prompts to Linux and macOS installers
This commit is contained in:
2026-01-24 09:11:07 +00:00
parent dbeadcf1e4
commit 006a3add58
3 changed files with 178 additions and 12 deletions

View File

@@ -7,14 +7,57 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
SRC_PS1="$REPO_ROOT/ps1/ps1.sh"
DST_DIR="$HOME/.config/ps1"
DST_PS1="$DST_DIR/ps1.sh"
SEASON_FILE="$DST_DIR/season"
MARKER_START="# >>> user ps1 (managed) >>>"
MARKER_END="# <<< user ps1 (managed) <<<"
season_mode="dynamic"
season_choice=""
if [[ -t 0 ]]; then
echo "Season mode:"
echo " 1) Dynamic (auto by date)"
echo " 2) Static (pick one season)"
read -r -p "Choose [1]: " season_mode_choice
case "${season_mode_choice}" in
2)
season_mode="static"
echo "Pick a season:"
echo " 1) Winter"
echo " 2) Spring"
echo " 3) Summer"
echo " 4) Autumn"
read -r -p "Choose [1]: " season_pick
case "${season_pick}" in
2) season_choice="spring" ;;
3) season_choice="summer" ;;
4) season_choice="autumn" ;;
""|1) season_choice="winter" ;;
*) echo "Invalid choice, using winter."; season_choice="winter" ;;
esac
;;
""|1)
season_mode="dynamic"
;;
*)
echo "Invalid choice, using dynamic."
season_mode="dynamic"
;;
esac
fi
mkdir -p "$DST_DIR"
cp -f "$SRC_PS1" "$DST_PS1"
chmod 0644 "$DST_PS1"
{
printf 'PS1_SEASON_MODE=%s\n' "$season_mode"
if [[ "$season_mode" == "static" && -n "$season_choice" ]]; then
printf 'PS1_SEASON=%s\n' "$season_choice"
fi
} > "$SEASON_FILE"
chmod 0644 "$SEASON_FILE"
add_source_block() {
local file="$1"
[[ -f "$file" ]] || touch "$file"