summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2020-01-18 17:58:48 +0300
committerromkatv <roman.perepelitsa@gmail.com>2020-01-18 17:58:48 +0300
commit573f2549cc1f89c495e823e81a92a0ecf35cc824 (patch)
tree0726003e4c2be89c52cd89776bb18cd9f04feece
parent0d33157b1232123bda62d86be6313f1012cc3bd7 (diff)
add back POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME support
-rw-r--r--internal/p10k.zsh16
1 files changed, 13 insertions, 3 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 63122497..1b5a508e 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -2698,6 +2698,17 @@ instant_prompt_time() {
_p9k_prompt_segment prompt_time "$_p9k_color2" "$_p9k_color1" "TIME_ICON" 1 '' $stash$_p9k_ret
}
+_p9k_prompt_time_init() {
+ (( _POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME )) || return
+ _p9k_worker_send_functions _p9k_prompt_time_compute
+}
+
+_p9k_prompt_time_compute() {
+ (( _POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME )) || return
+ _p9k_worker_invoke \
+ 'time' '(( _p9k_worker_runs_me ))' 'sleep 1' '_p9k_worker_reply _p9k_prompt_time_compute'
+}
+
################################################################
# System date
prompt_date() {
@@ -5275,7 +5286,6 @@ _p9k_init_params() {
_p9k_declare -b POWERLEVEL9K_TIME_UPDATE_ON_COMMAND 0
# If set to true, time will update every second.
_p9k_declare -b POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME 0
- _p9k_segment_in_use time || _POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME=0
local -i i=1
while (( i <= $#_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS )); do
@@ -6253,7 +6263,6 @@ function _p9k_init_cacheable() {
local -U segments=(
${_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS%_joined}
${_POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS%_joined})
- (( _POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME )) && segments+=ticking_clock
if [[ -n $_POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE ||
-n $_POWERLEVEL9K_IP_INTERFACE ||
-n $_POWERLEVEL9K_VPN_IP_INTERFACE ]]; then
@@ -6263,7 +6272,8 @@ function _p9k_init_cacheable() {
local f_init=_p9k_prompt_${elem}_init
local f_compute=_p9k_prompt_${elem}_compute
if (( $+functions[$f_init] || $+functions[$f_compute] )); then
- _p9k_async_segments+=("$f_init" "$f_compute")
+ (( $+functions[$f_init] )) && _p9k_async_segments+="$f_init" || _p9k_async_segments+=''
+ (( $+functions[$f_compute] )) && _p9k_async_segments+="$f_compute" || _p9k_async_segments+=''
fi
done