Fix demo rotation and move demo to top

This commit is contained in:
2026-01-24 18:27:03 +00:00
parent ae66cbc70e
commit 3f9bc8f9fa
3 changed files with 61 additions and 62 deletions

View File

@@ -171,36 +171,36 @@ if [[ -t 0 ]]; then
if [[ "$style_pack" == "contest" ]]; then if [[ "$style_pack" == "contest" ]]; then
echo echo
echo "Style presets:" echo "Style presets:"
echo " 1) Aurora - Powerline blocks, seasonal palette, two-line" echo " 1) Demo - Cycles all themes every prompt"
echo " Preview: [date time user] > [@host /path]"
echo " 2) Neon - Magenta/cyan cyber blocks, high contrast"
echo " Preview: [user time] > [@host /path]"
echo " 3) Forge - Warm copper blocks, heavy frame"
echo " Preview: [date time user] > [@host /path]"
echo " 4) Circuit - Green scanline, minimal rails"
echo " Preview: [user time] - @host /path"
echo " 5) Mono - Clean monochrome, fast read"
echo " Preview: [date time user] @host /path"
echo " 6) Git - Minimal with git capsule"
echo " Preview: [date time user] @host - /path (git)"
echo " 7) Hawolex - Winter neon, tech icons"
echo " Preview: [date time user] @host - /path"
echo " 8) HawolexV2 - Winter neon gradient"
echo " Preview: [date time user] @host - /path"
echo " 9) Demo - Cycles all themes every prompt"
echo " Preview: (auto-rotate)" echo " Preview: (auto-rotate)"
echo " 2) Aurora - Powerline blocks, seasonal palette, two-line"
echo " Preview: [date time user] > [@host /path]"
echo " 3) Neon - Magenta/cyan cyber blocks, high contrast"
echo " Preview: [user time] > [@host /path]"
echo " 4) Forge - Warm copper blocks, heavy frame"
echo " Preview: [date time user] > [@host /path]"
echo " 5) Circuit - Green scanline, minimal rails"
echo " Preview: [user time] - @host /path"
echo " 6) Mono - Clean monochrome, fast read"
echo " Preview: [date time user] @host /path"
echo " 7) Git - Minimal with git capsule"
echo " Preview: [date time user] @host - /path (git)"
echo " 8) Hawolex - Winter neon, tech icons"
echo " Preview: [date time user] @host - /path"
echo " 9) HawolexV2 - Winter neon gradient"
echo " Preview: [date time user] @host - /path"
read -r -p "Choose style [1]: " style_pick read -r -p "Choose style [1]: " style_pick
case "${style_pick}" in case "${style_pick}" in
2) style_choice="neon" ;; 2) style_choice="aurora" ;;
3) style_choice="forge" ;; 3) style_choice="neon" ;;
4) style_choice="circuit" ;; 4) style_choice="forge" ;;
5) style_choice="mono" ;; 5) style_choice="circuit" ;;
6) style_choice="git" ;; 6) style_choice="mono" ;;
7) style_choice="hawolex" ;; 7) style_choice="git" ;;
8) style_choice="hawolexv2" ;; 8) style_choice="hawolex" ;;
9) style_choice="demo" ;; 9) style_choice="hawolexv2" ;;
""|1) style_choice="aurora" ;; ""|1) style_choice="demo" ;;
*) echo "Invalid choice, using aurora."; style_choice="aurora" ;; *) echo "Invalid choice, using demo."; style_choice="demo" ;;
esac esac
elif [[ "$style_pack" == "custom" ]]; then elif [[ "$style_pack" == "custom" ]]; then

View File

@@ -147,36 +147,36 @@ if [[ -t 0 ]]; then
if [[ "$style_pack" == "contest" ]]; then if [[ "$style_pack" == "contest" ]]; then
echo echo
echo "Style presets:" echo "Style presets:"
echo " 1) Aurora - Powerline blocks, seasonal palette, two-line" echo " 1) Demo - Cycles all themes every prompt"
echo " Preview: [date time user] > [@host /path]"
echo " 2) Neon - Magenta/cyan cyber blocks, high contrast"
echo " Preview: [user time] > [@host /path]"
echo " 3) Forge - Warm copper blocks, heavy frame"
echo " Preview: [date time user] > [@host /path]"
echo " 4) Circuit - Green scanline, minimal rails"
echo " Preview: [user time] - @host /path"
echo " 5) Mono - Clean monochrome, fast read"
echo " Preview: [date time user] @host /path"
echo " 6) Git - Minimal with git capsule"
echo " Preview: [date time user] @host - /path (git)"
echo " 7) Hawolex - Winter neon, tech icons"
echo " Preview: [date time user] @host - /path"
echo " 8) HawolexV2 - Winter neon gradient"
echo " Preview: [date time user] @host - /path"
echo " 9) Demo - Cycles all themes every prompt"
echo " Preview: (auto-rotate)" echo " Preview: (auto-rotate)"
echo " 2) Aurora - Powerline blocks, seasonal palette, two-line"
echo " Preview: [date time user] > [@host /path]"
echo " 3) Neon - Magenta/cyan cyber blocks, high contrast"
echo " Preview: [user time] > [@host /path]"
echo " 4) Forge - Warm copper blocks, heavy frame"
echo " Preview: [date time user] > [@host /path]"
echo " 5) Circuit - Green scanline, minimal rails"
echo " Preview: [user time] - @host /path"
echo " 6) Mono - Clean monochrome, fast read"
echo " Preview: [date time user] @host /path"
echo " 7) Git - Minimal with git capsule"
echo " Preview: [date time user] @host - /path (git)"
echo " 8) Hawolex - Winter neon, tech icons"
echo " Preview: [date time user] @host - /path"
echo " 9) HawolexV2 - Winter neon gradient"
echo " Preview: [date time user] @host - /path"
read -r -p "Choose style [1]: " style_pick read -r -p "Choose style [1]: " style_pick
case "${style_pick}" in case "${style_pick}" in
2) style_choice="neon" ;; 2) style_choice="aurora" ;;
3) style_choice="forge" ;; 3) style_choice="neon" ;;
4) style_choice="circuit" ;; 4) style_choice="forge" ;;
5) style_choice="mono" ;; 5) style_choice="circuit" ;;
6) style_choice="git" ;; 6) style_choice="mono" ;;
7) style_choice="hawolex" ;; 7) style_choice="git" ;;
8) style_choice="hawolexv2" ;; 8) style_choice="hawolex" ;;
9) style_choice="demo" ;; 9) style_choice="hawolexv2" ;;
""|1) style_choice="aurora" ;; ""|1) style_choice="demo" ;;
*) echo "Invalid choice, using aurora."; style_choice="aurora" ;; *) echo "Invalid choice, using demo."; style_choice="demo" ;;
esac esac
elif [[ "$style_pack" == "custom" ]]; then elif [[ "$style_pack" == "custom" ]]; then

View File

@@ -228,14 +228,13 @@ _ps1_demo_next() {
"" "" "" "" "" "" "" "" "" "" "" "" "" ""
) )
local count=${#styles[@]} local count=${#styles[@]}
if [[ -z "${__PS1_DEMO_INDEX+x}" ]]; then local idx="${PS1_DEMO_INDEX:--1}"
__PS1_DEMO_INDEX=0 idx=$(( (idx + 1) % count ))
else PS1_DEMO_INDEX="$idx"
__PS1_DEMO_INDEX=$(( (__PS1_DEMO_INDEX + 1) % count )) export PS1_DEMO_INDEX
fi __PS1_DEMO_STYLE="${styles[$idx]}"
__PS1_DEMO_STYLE="${styles[$__PS1_DEMO_INDEX]}" __PS1_DEMO_PACK="${packs[$idx]}"
__PS1_DEMO_PACK="${packs[$__PS1_DEMO_INDEX]}" __PS1_DEMO_HOLIDAY="${holidays[$idx]}"
__PS1_DEMO_HOLIDAY="${holidays[$__PS1_DEMO_INDEX]}"
} }
# ---- Load Git prompt helper (best effort) ---- # ---- Load Git prompt helper (best effort) ----