diff --git a/.context.json b/.context.json index aa8ce1b..4ebd7b1 100644 --- a/.context.json +++ b/.context.json @@ -161,10 +161,17 @@ "description": "Clean monochrome, fast read, low noise.", "layout": "two-line, minimal", "preview": "[date time user] @host /path" + }, + { + "id": "git", + "name": "Git", + "description": "Minimal blocks with git capsule when in repo.", + "layout": "two-line, git capsule on line 2", + "preview": "[date time user] @host - /path (git)" } ], "config": { - "env": "PS1_STYLE=aurora|neon|forge|circuit|mono; PS1_STYLE_PACK=standard|contest|holiday; PS1_CONTEST_LAYOUT=day-time-user|user-time|time-user|day-time; PS1_HOLIDAY=christmas|easter|halloween|valentine|thanksgiving|newyear|hawolex", + "env": "PS1_STYLE=aurora|neon|forge|circuit|mono|git; PS1_STYLE_PACK=standard|contest|holiday; PS1_CONTEST_LAYOUT=day-time-user|user-time|time-user|day-time; PS1_HOLIDAY=christmas|easter|halloween|valentine|thanksgiving|newyear|hawolex", "config_file_keys": [ "PS1_STYLE", "PS1_STYLE_PACK", diff --git a/contest-styles.json b/contest-styles.json index daab84e..ccdfbfd 100644 --- a/contest-styles.json +++ b/contest-styles.json @@ -100,7 +100,7 @@ } }, "hawolex": { - "palette": { "Z1_BG": 61, "Z1_FG": 255, "Z2_BG": 37, "Z2_FG": 255, "PATH_FG": 194, "FRAME": 60 }, + "palette": { "Z1_BG": 54, "Z1_FG": 255, "Z2_BG": 31, "Z2_FG": 255, "PATH_FG": 230, "FRAME": 24 }, "emoji_set": { "sunrise": [ "đŸ’ģ", "🚗", "🔊", "🎮" ], "work": [ "🎧", "đŸ•šī¸", "📟", "🧩" ], @@ -195,6 +195,25 @@ "fg_dim": 240 }, "preview": "[date time user] @host /path" + }, + { + "id": "git", + "name": "Git", + "tagline": "Repo-aware minimalism", + "description": "Minimal blocks with git capsule on line 2.", + "layout": { + "line1": "date time user | @host - /path", + "line2": "status arrow + emoji + git" + }, + "colors": { + "zone1_bg": 61, + "zone1_fg": 255, + "zone2_bg": 37, + "zone2_fg": 255, + "path_fg": 194, + "frame": 60 + }, + "preview": "[date time user] @host - /path (git)" } ], "seasonal_palettes": { diff --git a/dotfiles/install/install-linux-global.sh b/dotfiles/install/install-linux-global.sh index 034ae0e..ed6d9ed 100644 --- a/dotfiles/install/install-linux-global.sh +++ b/dotfiles/install/install-linux-global.sh @@ -149,12 +149,15 @@ if [[ -t 0 ]]; then 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)" read -r -p "Choose style [1]: " style_pick case "${style_pick}" in 2) style_choice="neon" ;; 3) style_choice="forge" ;; 4) style_choice="circuit" ;; 5) style_choice="mono" ;; + 6) style_choice="git" ;; ""|1) style_choice="aurora" ;; *) echo "Invalid choice, using aurora."; style_choice="aurora" ;; esac diff --git a/dotfiles/install/install-macos-user.sh b/dotfiles/install/install-macos-user.sh index 1736ad8..cfad87d 100644 --- a/dotfiles/install/install-macos-user.sh +++ b/dotfiles/install/install-macos-user.sh @@ -125,12 +125,15 @@ if [[ -t 0 ]]; then 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)" read -r -p "Choose style [1]: " style_pick case "${style_pick}" in 2) style_choice="neon" ;; 3) style_choice="forge" ;; 4) style_choice="circuit" ;; 5) style_choice="mono" ;; + 6) style_choice="git" ;; ""|1) style_choice="aurora" ;; *) echo "Invalid choice, using aurora."; style_choice="aurora" ;; esac diff --git a/dotfiles/ps1/ps1.sh b/dotfiles/ps1/ps1.sh index 00114e9..f341e2f 100644 --- a/dotfiles/ps1/ps1.sh +++ b/dotfiles/ps1/ps1.sh @@ -89,8 +89,8 @@ _ps1_season() { fi } -# Style selection (aurora/neon/forge/circuit/mono) -# PS1_STYLE=aurora|neon|forge|circuit|mono +# Style selection (aurora/neon/forge/circuit/mono/git) +# PS1_STYLE=aurora|neon|forge|circuit|mono|git # PS1_STYLE_PACK=standard|contest|holiday # PS1_CONTEST_LAYOUT=day-time-user|user-time|time-user|day-time # PS1_HOLIDAY=christmas|easter|halloween|valentine|thanksgiving|newyear|hawolex @@ -141,6 +141,26 @@ _ps1_holiday() { echo "$holiday" } +# ---- Load Git prompt helper (best effort) ---- +__try_source_git_prompt() { + local candidates=( + "/usr/share/git/completion/git-prompt.sh" + "/usr/local/etc/bash_completion.d/git-prompt.sh" + "/etc/bash_completion.d/git-prompt.sh" + ) + for f in "${candidates[@]}"; do + [[ -r "$f" ]] && source "$f" && return 0 + done + return 1 +} +__try_source_git_prompt >/dev/null 2>&1 + +__git_capsule() { + if declare -F __git_ps1 >/dev/null 2>&1; then + __git_ps1 " (%s)" 2>/dev/null + fi +} + # Time-based emoji with seasonal accents (Europe/Oslo) _ps1_pick_icon() { local list_name="$1" @@ -362,12 +382,12 @@ _ps1_set_prompt() { FRAME="\[\e[38;5;19m\]" ;; hawolex) - Z1_BG="\[\e[48;5;61m\]" + Z1_BG="\[\e[48;5;54m\]" Z1_FG="\[\e[38;5;255m\]" - Z2_BG="\[\e[48;5;37m\]" + Z2_BG="\[\e[48;5;31m\]" Z2_FG="\[\e[38;5;255m\]" - PATH_FG="\[\e[38;5;194m\]" - FRAME="\[\e[38;5;60m\]" + PATH_FG="\[\e[38;5;230m\]" + FRAME="\[\e[38;5;24m\]" ;; *) Z1_BG="\[\e[48;5;24m\]" @@ -500,6 +520,22 @@ ${C_DIM}━${RST}${C_FG}${HOST_PART}${RST}${PATH_SEP}${C_PATH}${PATH_PART}${RST} ${PREFIX}${M_FG}âŸĻ${L1}⟧ ${M_DIM}${HOST_PART}${PATH_SEP}${M_FG}${PATH_PART}${RST}\ \n${M_DIM}└─${RST}${prompt_sym} ${__PS1_SYM} " ;; + git) + export GIT_PS1_SHOWDIRTYSTATE=1 + export GIT_PS1_SHOWSTASHSTATE=1 + local G_FRAME="\[\e[38;5;60m\]" + local G_Z1_BG="\[\e[48;5;61m\]" + local G_Z1_FG="\[\e[38;5;255m\]" + local G_Z2_BG="\[\e[48;5;37m\]" + local G_Z2_FG="\[\e[38;5;255m\]" + local G_PATH_FG="\[\e[38;5;194m\]" + local GIT_INFO="$(__git_capsule)" + PS1="\ +${PREFIX}${G_FRAME}╭─${RST}\ +${G_Z1_BG}${G_Z1_FG}${left} ${L1} ${RST}${G_Z1_BG}${G_Z2_BG}${G_Z2_FG}${sep}${RST}\ +${G_Z2_BG}${G_Z2_FG} ${HOST_PART}${PATH_SEP}${G_PATH_FG}${PATH_PART} ${RST}${G_Z2_BG}${G_Z2_FG}${right}${RST}\ +\n${G_FRAME}╰── ${RST}${prompt_sym} ${__PS1_SYM}${GIT_INFO} " + ;; *) # aurora (default) PS1="\