Initial commit

This commit is contained in:
2026-07-08 14:40:42 +02:00
commit 28c01e04d8
3 changed files with 55 additions and 0 deletions
Executable
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Defaults (override in .env)
PROMPT_ICON=""
PROMPT_HOST_COLOR="255;255;255"
PROMPT_DIR_COLOR="100;149;237"
PROMPT_VPN_NAME=""
PROMPT_VPN_COLOR="255;255;255"
_prompt_dir="${BASH_SOURCE[0]%/*}"
[[ -f "$_prompt_dir/.env" ]] && . "$_prompt_dir/.env"
__prompt_git() {
local branch
branch=$(git branch --show-current 2>/dev/null) || return
[[ -z $branch ]] && return
echo -n " (${branch})"
}
__prompt_vpn() {
[[ -z $PROMPT_VPN_NAME ]] && return
nmcli -f GENERAL.STATE con show "$PROMPT_VPN_NAME" &>/dev/null || return
echo -n " → \[\e[38;2;${PROMPT_VPN_COLOR}m\]${PROMPT_VPN_NAME}\[\e[0m\]"
}
__prompt_build() {
local white='\[\e[37m\]'
local reset='\[\e[0m\]'
local host_color="\[\e[38;2;${PROMPT_HOST_COLOR}m\]"
local dir_color="\[\e[38;2;${PROMPT_DIR_COLOR}m\]"
PS1="${white}[${reset}"
PS1+="${host_color}\u@\h${r}"
PS1+="$(__prompt_vpn)"
PS1+="${white}:${reset}"
PS1+="${dir_color}${PWD}${reset}"
PS1+="${white}]${reset}"
PS1+=" ${PROMPT_ICON}"
PS1+="$(__prompt_git)"
PS1+=' \$ '
}
PROMPT_COMMAND=__prompt_build