This commit is contained in:
2026-01-24 03:40:05 +00:00
parent e61b41bbbf
commit d3f6bd8f6d

28
ps1.sh
View File

@@ -39,7 +39,7 @@ _ps1_symbol() {
}
# -------------------------------------------------
# Path shortening (keeps /home/user)
# Path shortening (keeps /home/user visible)
# -------------------------------------------------
_ps1_path() {
local p="$PWD"
@@ -75,14 +75,30 @@ __PS1_PREV_PROMPT_COMMAND="${PROMPT_COMMAND-}"
ps1_on() {
PROMPT_COMMAND="_ps1_update"
local BOX="\[\e[38;5;183m\]"
local VAL="\[\e[38;5;117m\]"
local ACC="\[\e[38;5;229m\]"
# Foreground colors
local BOX_FG="\[\e[38;5;183m\]"
local DATE_FG="\[\e[38;5;229m\]" # date
local TIME_FG="\[\e[38;5;159m\]" # time (different from date)
local USER_FG="\[\e[38;5;81m\]" # user
local HOST_FG="\[\e[38;5;214m\]" # host (different from user)
local PATH_FG="\[\e[38;5;117m\]" # path
# Background blocks (inspired by your screenshot)
# Use subtle backgrounds + readable foregrounds.
local DATE_BG="\[\e[48;5;236m\]"
local USER_BG="\[\e[48;5;238m\]"
local PATH_BG="\[\e[48;5;236m\]"
# Status colors
local OK="\[\e[38;5;76m\]"
local BAD="\[\e[38;5;203m\]"
local RST="\[\e[0m\]"
PS1="${BOX}╭─(${ACC}\d${BOX} ${ACC}\A${BOX})-(${VAL}\u${BOX}@${VAL}\h${BOX})-(${VAL}\${__PS1_PATH}${BOX})${RST}\n${BOX}╰──\$( [ \$__PS1_STATUS -eq 0 ] && printf '${OK}' || printf '${BAD}' )➜ ${RST}\$ \${__PS1_SYM} "
local RST="\[\e[0m\]"
local SP=" " # just for readability
# Keep exact order:
# date, time, user@host, full/short path, newline, arrow + $ + time-based emoji
PS1="${BOX_FG}╭─(${DATE_BG}${DATE_FG}\d${RST}${BOX_FG}${SP}${DATE_BG}${TIME_FG}\A${RST}${BOX_FG})-(${USER_BG}${USER_FG}\u${RST}${BOX_FG}@${USER_BG}${HOST_FG}\h${RST}${BOX_FG})-(${PATH_BG}${PATH_FG}\${__PS1_PATH}${RST}${BOX_FG})${RST}\n${BOX_FG}╰──\$( [ \$__PS1_STATUS -eq 0 ] && printf '${OK}' || printf '${BAD}' )➜ ${RST}\$ \${__PS1_SYM} "
}
ps1_off() {