fix: working under Zsh
This commit is contained in:
parent
8083f63500
commit
4f9312af01
2 changed files with 21 additions and 20 deletions
|
|
@ -282,7 +282,7 @@ _lp_dotmatrix_theme_directory() {
|
|||
|
||||
_lp_dotmatrix_theme_prompt() {
|
||||
|
||||
local header inline prompt
|
||||
local header inline dotmatrix_prompt
|
||||
|
||||
# Arguments: fg, bg, bold, underline, fallback_fg, fallback_bg
|
||||
# Color codes can be any integer in 256 XTerm's system colors in [0–255].
|
||||
|
|
@ -296,6 +296,7 @@ _lp_dotmatrix_theme_prompt() {
|
|||
# HEADER (LEFT)
|
||||
####################################################################
|
||||
|
||||
# PS1="headering> "
|
||||
header=""
|
||||
header+="${_DOTMATRIX_DISPLAY}"
|
||||
header+="${_DOTMATRIX_CONNECTION}"
|
||||
|
|
@ -549,7 +550,7 @@ _lp_dotmatrix_theme_prompt() {
|
|||
|
||||
inline_right+="${DOTMATRIX_LINE}"
|
||||
|
||||
local inline
|
||||
local inline=
|
||||
# FIXME use _lp_fill-like function to handle multi-character line?
|
||||
if ((DOTMATRIX_ENABLE_GRADIENT_LINE)); then
|
||||
# Fill up the center section with a line colored as a gradient.
|
||||
|
|
@ -587,35 +588,35 @@ _lp_dotmatrix_theme_prompt() {
|
|||
# PROMPT LINE
|
||||
####################################################################
|
||||
|
||||
prompt=""
|
||||
dotmatrix_prompt=""
|
||||
lp_terminal_format ${DOTMATRIX_COLOR_DARK[@]+"${DOTMATRIX_COLOR_DARK[@]}"}
|
||||
|
||||
if (( LP_ENABLE_WIFI_STRENGTH )) ; then
|
||||
if _lp_wifi_signal_strength ; then
|
||||
lp_terminal_format ${DOTMATRIX_COLOR_WARN[@]+"${DOTMATRIX_COLOR_WARN[@]}"}
|
||||
prompt+="${lp_terminal_format}${LP_MARK_WIFI}"
|
||||
dotmatrix_prompt+="${lp_terminal_format}${LP_MARK_WIFI}"
|
||||
else
|
||||
prompt+="${lp_terminal_format}${LP_MARK_WIFI}"
|
||||
dotmatrix_prompt+="${lp_terminal_format}${LP_MARK_WIFI}"
|
||||
fi
|
||||
else
|
||||
prompt+="${lp_terminal_format}·"
|
||||
dotmatrix_prompt+="${lp_terminal_format}·"
|
||||
fi
|
||||
|
||||
if _lp_http_proxy ; then
|
||||
__dotmatrix_make_sep_link ${DOTMATRIX_COLOR_LITE[@]+"${DOTMATRIX_COLOR_LITE[@]}"}
|
||||
prompt+="${dotmatrix_sep}"
|
||||
dotmatrix_prompt+="${dotmatrix_sep}"
|
||||
else
|
||||
__dotmatrix_make_sep_plug ${DOTMATRIX_COLOR_LITE[@]+"${DOTMATRIX_COLOR_LITE[@]}"}
|
||||
prompt+="${dotmatrix_sep}"
|
||||
dotmatrix_prompt+="${dotmatrix_sep}"
|
||||
fi
|
||||
|
||||
__dotmatrix_prompt_vcs
|
||||
prompt+="${_DOTMATRIX_VCS}"
|
||||
dotmatrix_prompt+="${_DOTMATRIX_VCS}"
|
||||
|
||||
if _lp_runtime_format ; then
|
||||
__dotmatrix_make_sep_plug ${DOTMATRIX_COLOR_NOTE[@]+"${DOTMATRIX_COLOR_NOTE[@]}"}
|
||||
__dotmatrix_make_field "${lp_runtime_format}" ${DOTMATRIX_COLOR_NOTE[@]+"${DOTMATRIX_COLOR_NOTE[@]}"}
|
||||
prompt+="${dotmatrix_sep}${dotmatrix_field}"
|
||||
dotmatrix_prompt+="${dotmatrix_sep}${dotmatrix_field}"
|
||||
fi
|
||||
|
||||
if _lp_error ; then
|
||||
|
|
@ -627,11 +628,11 @@ _lp_dotmatrix_theme_prompt() {
|
|||
fi
|
||||
__dotmatrix_make_sep_link ${DOTMATRIX_COLOR_WARN[@]+"${DOTMATRIX_COLOR_WARN[@]}"}
|
||||
__dotmatrix_make_field "${DOTMATRIX_MARK_ERROR}${DOTMATRIX_SPACE_VOID}${error_msg}" ${DOTMATRIX_COLOR_WARN[@]+"${DOTMATRIX_COLOR_WARN[@]}"}
|
||||
prompt+="${dotmatrix_sep}${dotmatrix_field}"
|
||||
dotmatrix_prompt+="${dotmatrix_sep}${dotmatrix_field}"
|
||||
fi
|
||||
|
||||
__dotmatrix_make_sep_plug ${DOTMATRIX_COLOR_MARK[@]+"${DOTMATRIX_COLOR_MARK[@]}"}
|
||||
prompt+="${dotmatrix_sep}"
|
||||
dotmatrix_prompt+="${dotmatrix_sep}"
|
||||
lp_terminal_format ${DOTMATRIX_COLOR_MARK[@]+"${DOTMATRIX_COLOR_MARK[@]}"}
|
||||
local mark_color="$lp_terminal_format"
|
||||
|
||||
|
|
@ -639,11 +640,11 @@ _lp_dotmatrix_theme_prompt() {
|
|||
if _lp_shell_level ; then
|
||||
local i
|
||||
for ((i=0; i < lp_shell_level-1; i++)); do
|
||||
prompt+="${mark_color}${DOTMATRIX_MARK}"
|
||||
dotmatrix_prompt+="${mark_color}${DOTMATRIX_MARK}"
|
||||
done
|
||||
fi
|
||||
|
||||
# Warning prompt mark if either root or sudo.
|
||||
# Warning dotmatrix_prompt mark if either root or sudo.
|
||||
_lp_user
|
||||
user="$?"
|
||||
# No need to check LP_ENABLE_SUDO, _lp_sudo_active does it.
|
||||
|
|
@ -653,16 +654,16 @@ _lp_dotmatrix_theme_prompt() {
|
|||
local dcwfg="${DOTMATRIX_COLOR_WARN[_LP_FIRST_INDEX+1]}"
|
||||
[[ -z $dcwfg ]] && dcwfg=-1
|
||||
lp_terminal_format $dcwfg
|
||||
prompt+="${lp_terminal_format}${DOTMATRIX_MARK}"
|
||||
dotmatrix_prompt+="${lp_terminal_format}${DOTMATRIX_MARK}"
|
||||
else
|
||||
prompt+="${mark_color}${DOTMATRIX_MARK}"
|
||||
dotmatrix_prompt+="${mark_color}${DOTMATRIX_MARK}"
|
||||
fi
|
||||
|
||||
prompt+="${NO_COL}"
|
||||
dotmatrix_prompt+="${NO_COL}"
|
||||
|
||||
# Assemble and setup
|
||||
local n=$'\n'
|
||||
PS1="${n}${header}${n}${inline}${n}${prompt} "
|
||||
PS1="${n}${header}${n}${inline}${n}${dotmatrix_prompt} "
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -875,7 +876,7 @@ __dotmatrix_directory_path() {
|
|||
|
||||
|
||||
########################################################################
|
||||
# Functions called at prompt update.
|
||||
# Functions called at dotmatrix_prompt update.
|
||||
########################################################################
|
||||
|
||||
__dotmatrix_prompt_vcs() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue