mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-23 15:41:57 +00:00
remove _P9K_H* stuff that is no longer necessary
This commit is contained in:
parent
25510ef7ad
commit
ab43f19909
1 changed files with 16 additions and 43 deletions
|
@ -2034,9 +2034,6 @@ typeset -fH _p9k_set_prompt() {
|
||||||
build_right_prompt
|
build_right_prompt
|
||||||
RPROMPT=$_P9K_RIGHT_PREFIX$_P9K_PROMPT$_P9K_RIGHT_SUFFIX
|
RPROMPT=$_P9K_RIGHT_PREFIX$_P9K_PROMPT$_P9K_RIGHT_SUFFIX
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset _P9K_H1
|
|
||||||
unset _P9K_H2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typeset -g _P9K_REFRESH_REASON
|
typeset -g _P9K_REFRESH_REASON
|
||||||
|
@ -2085,46 +2082,30 @@ typeset -g OS
|
||||||
typeset -g OS_ICON
|
typeset -g OS_ICON
|
||||||
typeset -g SED_EXTENDED_REGEX_PARAMETER
|
typeset -g SED_EXTENDED_REGEX_PARAMETER
|
||||||
|
|
||||||
typeset -gi _P9K_TIMER_FD1=0
|
typeset -gi _P9K_TIMER_FD=0
|
||||||
typeset -gi _P9K_TIMER_FD2=0
|
|
||||||
|
|
||||||
_p9k_init_timer() {
|
_p9k_init_timer() {
|
||||||
local fifo1 fifo2
|
local fifo
|
||||||
|
|
||||||
_p9k_start_timer() {
|
_p9k_start_timer() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
setopt err_return no_bg_nice
|
setopt err_return no_bg_nice
|
||||||
|
|
||||||
fifo1=$(mktemp -u "${TMPDIR:-/tmp}"/p9k.$$.pipe1.timer.XXXXXXXXXX)
|
fifo=$(mktemp -u "${TMPDIR:-/tmp}"/p9k.$$.pipe.timer.XXXXXXXXXX)
|
||||||
fifo2=$(mktemp -u "${TMPDIR:-/tmp}"/p9k.$$.pipe2.timer.XXXXXXXXXX)
|
mkfifo $fifo
|
||||||
mkfifo $fifo1
|
exec {_P9K_TIMER_FD}<>$fifo
|
||||||
mkfifo $fifo2
|
|
||||||
exec {_P9K_TIMER_FD1}<>$fifo1
|
|
||||||
exec {_P9K_TIMER_FD2}<>$fifo2
|
|
||||||
|
|
||||||
function _p9k_on_timer() {
|
function _p9k_on_timer() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
local reason
|
local dummy && IFS='' read -u $_P9K_TIMER_FD dummy && zle .reset-prompt
|
||||||
IFS='' read -u $_P9K_TIMER_FD1 reason || return
|
|
||||||
unset _P9K_H1
|
|
||||||
unset _P9K_H2
|
|
||||||
[[ -n $reason ]] && _p9k_update_prompt $reason || zle .reset-prompt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zle -F $_P9K_TIMER_FD1 _p9k_on_timer
|
zle -F $_P9K_TIMER_FD _p9k_on_timer
|
||||||
|
|
||||||
# This `sleep 1 && kill -WINCH $$` is a workaround for what seems like a bug in zsh.
|
# `kill -WINCH $$` is a workaround for a bug in zsh. After a background job completes, callbacks
|
||||||
zsh -c "
|
# registered with `zle -F` stop firing until the user presses any key or the process receives a
|
||||||
while kill -0 $$; do
|
# signal (any signal at all).
|
||||||
if IFS='' read -u $_P9K_TIMER_FD2 -t 1; then
|
zsh -c "while kill -WINCH $$; do sleep 1; echo; done" </dev/null >&$_P9K_TIMER_FD 2>/dev/null &!
|
||||||
sleep 1
|
|
||||||
kill -WINCH $$
|
|
||||||
echo job-complete
|
|
||||||
elif [[ $POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME == true ]]; then
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
" <&$_P9K_TIMER_FD2 >&$_P9K_TIMER_FD1 2>/dev/null &!
|
|
||||||
local pid=$!
|
local pid=$!
|
||||||
function _p9k_kill_timer_${pid}() {
|
function _p9k_kill_timer_${pid}() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
|
@ -2135,18 +2116,14 @@ _p9k_init_timer() {
|
||||||
|
|
||||||
if ! _p9k_start_timer ; then
|
if ! _p9k_start_timer ; then
|
||||||
echo "powerlevel10k: failed to initialize background timer" >&2
|
echo "powerlevel10k: failed to initialize background timer" >&2
|
||||||
if (( _P9K_TIMER_FD1 )); then
|
if (( _P9K_TIMER_FD )); then
|
||||||
zle -F $_P9K_TIMER_FD1
|
zle -F $_P9K_TIMER_FD
|
||||||
exec {_P9K_TIMER_FD1}>&-
|
exec {_P9K_TIMER_FD}>&-
|
||||||
|
_P9K_TIMER_FD=0
|
||||||
fi
|
fi
|
||||||
if (( _P9K_TIMER_FD2 )); then
|
|
||||||
exec {_P9K_TIMER_FD2}>&-
|
|
||||||
fi
|
|
||||||
_P9K_TIMER_FD1=0
|
|
||||||
_P9K_TIMER_FD2=0
|
|
||||||
unset -f _p9k_on_timer
|
unset -f _p9k_on_timer
|
||||||
fi
|
fi
|
||||||
command rm -f "$fifo1" "$fifo2"
|
command rm -f "$fifo"
|
||||||
}
|
}
|
||||||
|
|
||||||
_p9k_init() {
|
_p9k_init() {
|
||||||
|
@ -2279,10 +2256,6 @@ _p9k_init() {
|
||||||
_P9K_LEFT_PREFIX="%{$(iterm2_prompt_mark)%}$_P9K_LEFT_PREFIX"
|
_P9K_LEFT_PREFIX="%{$(iterm2_prompt_mark)%}$_P9K_LEFT_PREFIX"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if segment_in_use background_jobs && (( _P9K_TIMER_FD2 )); then
|
|
||||||
_P9K_LEFT_SUFFIX+="\${_P9K_H1+\${_P9K_H2-\${_P9K_H2=}\$(echo>&$_P9K_TIMER_FD2)}}\${_P9K_H1=}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If the terminal `LANG` is set to `C`, this theme will not work at all.
|
# If the terminal `LANG` is set to `C`, this theme will not work at all.
|
||||||
if [[ $LANG == C && $POWERLEVEL9K_IGNORE_TERM_LANG == false ]]; then
|
if [[ $LANG == C && $POWERLEVEL9K_IGNORE_TERM_LANG == false ]]; then
|
||||||
print -P "\t%F{red}WARNING!%f Your terminal's 'LANG' is set to 'C', which breaks this theme!"
|
print -P "\t%F{red}WARNING!%f Your terminal's 'LANG' is set to 'C', which breaks this theme!"
|
||||||
|
|
Loading…
Reference in a new issue