From 1878d67bfaf0fb73b2bd748624199c7e98105655 Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Mon, 8 Mar 2021 00:14:49 -0500 Subject: [PATCH 01/12] Added async docker segment to display number of running, paused and exited containers. --- README.md | 1 + config/p10k-classic.zsh | 7 +++ config/p10k-lean-8colors.zsh | 7 +++ config/p10k-lean.zsh | 7 +++ config/p10k-rainbow.zsh | 7 +++ internal/icons.zsh | 18 +++++++ internal/p10k.zsh | 95 ++++++++++++++++++++++++++++++++++++ 7 files changed, 142 insertions(+) diff --git a/README.md b/README.md index 32e606caa..f7fce12c5 100644 --- a/README.md +++ b/README.md @@ -297,6 +297,7 @@ enable as many segments as you like. It won't slow down your prompt or Zsh start | `laravel_version` | [laravel php framework](https://laravel.com/) version | | `java_version` | [java](https://www.java.com/) version | | `package` | `name@version` from [package.json](https://docs.npmjs.com/files/package.json) | +| `docker` | current number of running and exited [docker](https://docker.io/) containers | | `kubecontext` | current [kubernetes](https://kubernetes.io/) context | | `terraform` | [terraform](https://www.terraform.io) workspace | | `aws` | [aws profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) | diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 731d6cd9c..1a2006869 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -100,6 +100,7 @@ # battery # internal battery # wifi # wifi speed # example # example user-defined segment (see prompt_example function below) + # docker # Docker containers running and exited (https://www.docker.io) ) # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. @@ -1192,6 +1193,12 @@ typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=38 # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' + #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# + # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' + #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. # Tip: Remove the next line to always show kubecontext. diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index 58a691f44..60fff2fe4 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -99,6 +99,7 @@ # battery # internal battery # wifi # wifi speed # example # example user-defined segment (see prompt_example function below) + # docker # Docker containers running and exited (https://www.docker.io) ) # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. @@ -1140,6 +1141,12 @@ # Custom icon. # typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐' + #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# + # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' + #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. # Tip: Remove the next line to always show kubecontext. diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index b5e148e02..cb5993bcb 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -99,6 +99,7 @@ # battery # internal battery # wifi # wifi speed # example # example user-defined segment (see prompt_example function below) + # docker # Docker containers running and exited (https://www.docker.io) ) # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. @@ -1136,6 +1137,12 @@ # Custom icon. # typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐' + #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# + # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' + #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. # Tip: Remove the next line to always show kubecontext. diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index 06d1426de..84fd27d5f 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -100,6 +100,7 @@ # battery # internal battery # wifi # wifi speed # example # example user-defined segment (see prompt_example function below) + # docker # Docker containers running and exited (https://www.docker.io) ) # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. @@ -1258,6 +1259,12 @@ typeset -g POWERLEVEL9K_TERRAFORM_OTHER_BACKGROUND=0 # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' + #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# + # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' + #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. # Tip: Remove the next line to always show kubecontext. diff --git a/internal/icons.zsh b/internal/icons.zsh index 532ab0a6a..27bb45be7 100644 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -144,6 +144,9 @@ function _p9k_init_icons() { PACKAGE_ICON 'pkg' JULIA_ICON 'jl' SCALA_ICON 'scala' + DOCKER_ICON '\UE7B0' + ONLINE_ICON '\UF111' + PAUSE_ICON '\UF04C' #  ) ;; 'awesome-fontconfig') @@ -272,6 +275,9 @@ function _p9k_init_icons() { PACKAGE_ICON 'pkg' JULIA_ICON 'jl' SCALA_ICON 'scala' + DOCKER_ICON '\UE7B0' + ONLINE_ICON '\UF111' + PAUSE_ICON '\UF04C' #  ) ;; 'awesome-mapped-fontconfig') @@ -403,6 +409,9 @@ function _p9k_init_icons() { PACKAGE_ICON 'pkg' JULIA_ICON 'jl' SCALA_ICON 'scala' + DOCKER_ICON '\UE7B0' + ONLINE_ICON '\UF111' + PAUSE_ICON '\UF04C' #  ) ;; 'nerdfont-complete'|'nerdfont-fontconfig') @@ -532,6 +541,9 @@ function _p9k_init_icons() { PACKAGE_ICON '\uF8D6' #  JULIA_ICON '\uE624' #  SCALA_ICON '\uE737' #  + DOCKER_ICON '\UE7B0' #  + ONLINE_ICON '\UF111' #  + PAUSE_ICON '\UF04C' #  ) ;; ascii) @@ -658,6 +670,9 @@ function _p9k_init_icons() { PACKAGE_ICON 'pkg' JULIA_ICON 'jl' SCALA_ICON 'scala' + DOCKER_ICON 'docker' + ONLINE_ICON 'o' + PAUSE_ICON '"' ) ;; *) @@ -786,6 +801,9 @@ function _p9k_init_icons() { PACKAGE_ICON 'pkg' JULIA_ICON 'jl' SCALA_ICON 'scala' + DOCKER_ICON '\UE7B0' + ONLINE_ICON '\UF111' + PAUSE_ICON '\UF04C' #  ) ;; esac diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 43fa83365..59aee1560 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1247,6 +1247,101 @@ function _p9k_fvm_new() { return 1 } +##################################################################### +# Docker support - Appears if docker cli can talk to server. +# Shows # running and # stopped containers. +# +# Also commented with instructions on how to write an async segment. +##################################################################### +# The main prompt_ function adds the prompt segment definitions, but +# the data will be computed elsewhere. +function prompt_docker() { + # Save the length for the last line + local -i len=$#_p9k__prompt _p9k__has_upglob + + # Register the segments. Search for _p9k_left_prompt_segment for argument docs + _p9k_prompt_segment $0 NONE green DOCKER_ICON 1 '$_p9k__docker_segment' '$_p9k__docker_segment' + + # Copy and paste this line; no changes needed. + (( _p9k__has_upglob )) || typeset -g "_p9k__segment_val_${_p9k__prompt_side}[_p9k__segment_index]"=$_p9k__prompt[len+1,-1] +} + +# The _init function must be named according to the pattern seen here. +function _p9k_prompt_docker_init() { + # Abort if the command isn't available. + (( $+commands[docker] )) || return + + # Declare global variable to hold the segment content + typeset -g _p9k__docker_segment= + + # Register this segment for async computation. Again note the pattern + _p9k__async_segments_compute+='_p9k_worker_invoke docker _p9k_prompt_docker_compute' +} + +# Runs the workers +function _p9k_prompt_docker_compute() { + (( $+commands[docker] )) || return + + # Copy and paste this line. Follow the pattern and adapt for your segment name. + _p9k_worker_async _p9k_prompt_docker_async _p9k_prompt_docker_sync + + # See the other invocations of _p9k_worker_async for examples of argument + # passing to the async impl. The sync impl should not take args. +} + +# `_async` runs the slow processes and converts the output into variables. +# +# The content will then be rendered by the segment template that was previously +# registered by the _p9k_prompt_segment in the `prompt_` function. +# +function _p9k_prompt_docker_async() { + (( $+commands[docker] )) || return + + local -A container_status_counts + container_status_counts=(E 0 U 0 P 0) + + # Minimize all use of subshells and command invocations in general. + # Async is not a license to be needlessly slow. + for line in ${(f)"$(command docker ps -a --format '{{ .Status }}' 2>/dev/null)"}; do + if [[ "$line" == *(Paused)* ]]; then + (( container_status_counts[P]++ )) + else + (( container_status_counts[${line:0:1}]++ )) + fi + _p9k__docker_up=1 + done + + _p9k__docker_segment= + + _p9k_get_icon '' ONLINE_ICON + (( ${container_status_counts[U]} )) && \ + _p9k__docker_segment="%F{green}${POWERLEVEL9K_DOCKER_RUNNING_ICON:-$_p9k__ret} ${container_status_counts[U]} %f" + + _p9k_get_icon '' PAUSE_ICON + (( ${container_status_counts[P]} )) && \ + _p9k__docker_segment+="%F{yellow}${POWERLEVEL9K_DOCKER_PAUSED_ICON:-$_p9k__ret} ${container_status_counts[P]} %f" + + _p9k_get_icon '' FAIL_ICON + (( ${container_status_counts[E]} )) && \ + _p9k__docker_segment+="%F{red}${POWERLEVEL9K_DOCKER_EXITED_ICON:-$_p9k__ret} ${container_status_counts[E]} %f" + + # All vars that may have changed state must be sent to _p9k_print_params + _p9k_print_params \ + _p9k__docker_segment + + # The function must end with a reset=value + echo -E - 'reset=1' +} + +# Copy, paste, and rename this function. +function _p9k_prompt_docker_sync() { + if [[ -n $REPLY ]]; then + eval $REPLY + _p9k_worker_reply $REPLY + fi +} +########################################################################## + prompt_fvm() { _p9k_fvm_new || _p9k_fvm_old } From b9baf4536d28344c9ab35be94491a5bdf342fd1a Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Mon, 8 Mar 2021 00:53:13 -0500 Subject: [PATCH 02/12] added a better icon for the running containers in the config files --- config/p10k-classic.zsh | 2 +- config/p10k-lean-8colors.zsh | 2 +- config/p10k-lean.zsh | 2 +- config/p10k-rainbow.zsh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 1a2006869..f63b433bd 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -1195,7 +1195,7 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index 60fff2fe4..eb2fe808f 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -1143,7 +1143,7 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index cb5993bcb..307639a91 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -1139,7 +1139,7 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index 84fd27d5f..2684bbab4 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -1261,7 +1261,7 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' From fa929dc372410e5fc3461bbc89daef8cf46f800f Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Mon, 8 Mar 2021 02:31:44 -0500 Subject: [PATCH 03/12] fix the detection when no containers online --- internal/icons.zsh | 10 +++++----- internal/p10k.zsh | 14 ++++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/internal/icons.zsh b/internal/icons.zsh index 27bb45be7..047053192 100644 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -145,7 +145,7 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' DOCKER_ICON '\UE7B0' - ONLINE_ICON '\UF111' + ONLINE_ICON '\UF674' PAUSE_ICON '\UF04C' #  ) ;; @@ -276,7 +276,7 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' DOCKER_ICON '\UE7B0' - ONLINE_ICON '\UF111' + ONLINE_ICON '\UF674' PAUSE_ICON '\UF04C' #  ) ;; @@ -410,7 +410,7 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' DOCKER_ICON '\UE7B0' - ONLINE_ICON '\UF111' + ONLINE_ICON '\UF674' PAUSE_ICON '\UF04C' #  ) ;; @@ -542,7 +542,7 @@ function _p9k_init_icons() { JULIA_ICON '\uE624' #  SCALA_ICON '\uE737' #  DOCKER_ICON '\UE7B0' #  - ONLINE_ICON '\UF111' #  + ONLINE_ICON '\UF674' #  PAUSE_ICON '\UF04C' #  ) ;; @@ -802,7 +802,7 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' DOCKER_ICON '\UE7B0' - ONLINE_ICON '\UF111' + ONLINE_ICON '\UF674' PAUSE_ICON '\UF04C' #  ) ;; diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 59aee1560..e83202201 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1260,7 +1260,7 @@ function prompt_docker() { local -i len=$#_p9k__prompt _p9k__has_upglob # Register the segments. Search for _p9k_left_prompt_segment for argument docs - _p9k_prompt_segment $0 NONE green DOCKER_ICON 1 '$_p9k__docker_segment' '$_p9k__docker_segment' + _p9k_prompt_segment $0 NONE green DOCKER_ICON 1 '$_p9k__docker_up' '$_p9k__docker_segment' # Copy and paste this line; no changes needed. (( _p9k__has_upglob )) || typeset -g "_p9k__segment_val_${_p9k__prompt_side}[_p9k__segment_index]"=$_p9k__prompt[len+1,-1] @@ -1298,11 +1298,14 @@ function _p9k_prompt_docker_async() { (( $+commands[docker] )) || return local -A container_status_counts - container_status_counts=(E 0 U 0 P 0) + container_status_counts=(E 0 U 0 P 0 S 0) + + _p9k__docker_up= + _p9k__docker_segment= # Minimize all use of subshells and command invocations in general. # Async is not a license to be needlessly slow. - for line in ${(f)"$(command docker ps -a --format '{{ .Status }}' 2>/dev/null)"}; do + for line in ${(f)"$( docker ps -a --format 'table {{ .Status }}' 2>/dev/null)"}; do if [[ "$line" == *(Paused)* ]]; then (( container_status_counts[P]++ )) else @@ -1311,8 +1314,6 @@ function _p9k_prompt_docker_async() { _p9k__docker_up=1 done - _p9k__docker_segment= - _p9k_get_icon '' ONLINE_ICON (( ${container_status_counts[U]} )) && \ _p9k__docker_segment="%F{green}${POWERLEVEL9K_DOCKER_RUNNING_ICON:-$_p9k__ret} ${container_status_counts[U]} %f" @@ -1327,7 +1328,8 @@ function _p9k_prompt_docker_async() { # All vars that may have changed state must be sent to _p9k_print_params _p9k_print_params \ - _p9k__docker_segment + _p9k__docker_segment \ + _p9k__docker_up # The function must end with a reset=value echo -E - 'reset=1' From 4244d047a08dad6f60a49866e7b605df9214c276 Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Mon, 8 Mar 2021 12:02:17 -0500 Subject: [PATCH 04/12] prevent icon conflict wrt docker icons and add more fun options to the config --- config/p10k-classic.zsh | 2 ++ config/p10k-lean-8colors.zsh | 2 ++ config/p10k-lean.zsh | 2 ++ config/p10k-rainbow.zsh | 2 ++ internal/icons.zsh | 30 ++++++++++++++++++------------ internal/p10k.zsh | 6 +++--- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index f63b433bd..d73311936 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -1196,6 +1196,8 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index eb2fe808f..4a3b57d32 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -1144,6 +1144,8 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 307639a91..871eb1eff 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -1140,6 +1140,8 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index 2684bbab4..3b0e4545e 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -1262,6 +1262,8 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' diff --git a/internal/icons.zsh b/internal/icons.zsh index 047053192..3abf3aca9 100644 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -145,8 +145,9 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' DOCKER_ICON '\UE7B0' - ONLINE_ICON '\UF674' - PAUSE_ICON '\UF04C' #  + DOCKER_CONTAINER_ONLINE_ICON '\UF674' + DOCKER_CONTAINER_PAUSE_ICON '\UF04C' #  + DOCKER_CONTAINER_EXIT_ICON '\UF00D' ) ;; 'awesome-fontconfig') @@ -276,8 +277,9 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' DOCKER_ICON '\UE7B0' - ONLINE_ICON '\UF674' - PAUSE_ICON '\UF04C' #  + DOCKER_CONTAINER_ONLINE_ICON '\UF674' + DOCKER_CONTAINER_PAUSE_ICON '\UF04C' #  + DOCKER_CONTAINER_EXIT_ICON '\UF00D' ) ;; 'awesome-mapped-fontconfig') @@ -410,8 +412,9 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' DOCKER_ICON '\UE7B0' - ONLINE_ICON '\UF674' - PAUSE_ICON '\UF04C' #  + DOCKER_CONTAINER_ONLINE_ICON '\UF674' + DOCKER_CONTAINER_PAUSE_ICON '\UF04C' + DOCKER_CONTAINER_EXIT_ICON '\UF00D' ) ;; 'nerdfont-complete'|'nerdfont-fontconfig') @@ -542,8 +545,9 @@ function _p9k_init_icons() { JULIA_ICON '\uE624' #  SCALA_ICON '\uE737' #  DOCKER_ICON '\UE7B0' #  - ONLINE_ICON '\UF674' #  - PAUSE_ICON '\UF04C' #  + DOCKER_CONTAINER_ONLINE_ICON '\UF674' #  + DOCKER_CONTAINER_PAUSE_ICON '\UF04C' #  + DOCKER_CONTAINER_EXIT_ICON '\UF00D' #  ) ;; ascii) @@ -671,8 +675,9 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' DOCKER_ICON 'docker' - ONLINE_ICON 'o' - PAUSE_ICON '"' + DOCKER_CONTAINER_ONLINE_ICON 'o' + DOCKER_CONTAINER_PAUSE_ICON '"' + DOCKER_CONTAINER_EXIT_ICON 'x' ) ;; *) @@ -802,8 +807,9 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' DOCKER_ICON '\UE7B0' - ONLINE_ICON '\UF674' - PAUSE_ICON '\UF04C' #  + DOCKER_CONTAINER_ONLINE_ICON '\UF674' + DOCKER_CONTAINER_PAUSE_ICON '\UF04C' #  + DOCKER_CONTAINER_EXIT_ICON '\UF00D' ) ;; esac diff --git a/internal/p10k.zsh b/internal/p10k.zsh index e83202201..3d0ab3541 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1314,15 +1314,15 @@ function _p9k_prompt_docker_async() { _p9k__docker_up=1 done - _p9k_get_icon '' ONLINE_ICON + _p9k_get_icon '' DOCKER_CONTAINER_ONLINE_ICON (( ${container_status_counts[U]} )) && \ _p9k__docker_segment="%F{green}${POWERLEVEL9K_DOCKER_RUNNING_ICON:-$_p9k__ret} ${container_status_counts[U]} %f" - _p9k_get_icon '' PAUSE_ICON + _p9k_get_icon '' DOCKER_CONTAINER_PAUSE_ICON (( ${container_status_counts[P]} )) && \ _p9k__docker_segment+="%F{yellow}${POWERLEVEL9K_DOCKER_PAUSED_ICON:-$_p9k__ret} ${container_status_counts[P]} %f" - _p9k_get_icon '' FAIL_ICON + _p9k_get_icon '' DOCKER_CONTAINER_EXIT_ICON (( ${container_status_counts[E]} )) && \ _p9k__docker_segment+="%F{red}${POWERLEVEL9K_DOCKER_EXITED_ICON:-$_p9k__ret} ${container_status_counts[E]} %f" From 5f18655eacaace7e697981fd67b6eee3aefdb264 Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Mon, 8 Mar 2021 12:22:46 -0500 Subject: [PATCH 05/12] declare _p9k__docker_up up front --- internal/p10k.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 3d0ab3541..8f1b551ad 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1273,6 +1273,7 @@ function _p9k_prompt_docker_init() { # Declare global variable to hold the segment content typeset -g _p9k__docker_segment= + typeset -g _p9k__docker_up= # Register this segment for async computation. Again note the pattern _p9k__async_segments_compute+='_p9k_worker_invoke docker _p9k_prompt_docker_compute' From 393312f092d4d21588959190b741f439f11e63c1 Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Wed, 10 Mar 2021 11:57:53 -0500 Subject: [PATCH 06/12] fix the icon names to fully leverage framework --- config/p10k-classic.zsh | 10 +++++----- config/p10k-lean-8colors.zsh | 10 +++++----- config/p10k-lean.zsh | 10 +++++----- config/p10k-rainbow.zsh | 10 +++++----- internal/p10k.zsh | 9 +++------ 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index d73311936..045eb4bcc 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -1195,11 +1195,11 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_PAUSE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_EXIT_ICON='' #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index 4a3b57d32..948fd2f39 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -1143,11 +1143,11 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_PAUSE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_EXIT_ICON='' #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 871eb1eff..6e0227631 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -1139,11 +1139,11 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_PAUSE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_EXIT_ICON='' #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index 3b0e4545e..dcf9150da 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -1261,11 +1261,11 @@ #############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]############# # typeset -g POWERLEVEL9K_DOCKER_ICON='🐳' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_RUNNING_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_PAUSED_ICON='' - # typeset -g POWERLEVEL9K_DOCKER_EXITED_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_PAUSE_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_EXIT_ICON='' #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 8f1b551ad..815d620a5 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1315,17 +1315,14 @@ function _p9k_prompt_docker_async() { _p9k__docker_up=1 done - _p9k_get_icon '' DOCKER_CONTAINER_ONLINE_ICON (( ${container_status_counts[U]} )) && \ - _p9k__docker_segment="%F{green}${POWERLEVEL9K_DOCKER_RUNNING_ICON:-$_p9k__ret} ${container_status_counts[U]} %f" + _p9k__docker_segment="%F{green}$(print_icon 'DOCKER_CONTAINER_ONLINE_ICON') ${container_status_counts[U]} %f" - _p9k_get_icon '' DOCKER_CONTAINER_PAUSE_ICON (( ${container_status_counts[P]} )) && \ - _p9k__docker_segment+="%F{yellow}${POWERLEVEL9K_DOCKER_PAUSED_ICON:-$_p9k__ret} ${container_status_counts[P]} %f" + _p9k__docker_segment+="%F{yellow}$(print_icon 'DOCKER_CONTAINER_PAUSE_ICON') ${container_status_counts[P]} %f" - _p9k_get_icon '' DOCKER_CONTAINER_EXIT_ICON (( ${container_status_counts[E]} )) && \ - _p9k__docker_segment+="%F{red}${POWERLEVEL9K_DOCKER_EXITED_ICON:-$_p9k__ret} ${container_status_counts[E]} %f" + _p9k__docker_segment+="%F{red}$(print_icon 'DOCKER_CONTAINER_EXIT_ICON') ${container_status_counts[E]} %f" # All vars that may have changed state must be sent to _p9k_print_params _p9k_print_params \ From 9571fa1e7534329ae0f762bb4ec69845a9f9c584 Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Thu, 22 Apr 2021 08:47:20 -0400 Subject: [PATCH 07/12] add _p9k_href and use it everywhere a hyperlink was created otherwise --- config/p10k-rainbow.zsh | 6 ++++++ internal/p10k.zsh | 38 ++++++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index dcf9150da..da1a0a49e 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -1266,6 +1266,12 @@ # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON='' # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_PAUSE_ICON='' # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_EXIT_ICON='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_VISUAL_IDENTIFIER_EXPANSION='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_VISUAL_IDENTIFIER_EXPANSION='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_VISUAL_IDENTIFIER_EXPANSION='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_PAUSE_VISUAL_IDENTIFIER_EXPANSION='' + # typeset -g POWERLEVEL9K_DOCKER_CONTAINER_EXIT_VISUAL_IDENTIFIER_EXPANSION='' + # typeset -g POWERLEVEL9K_DOCKER_CONTENT_EXPANSION='${DOCKER_ONLINE_CONTENT_EXPANSION}${DOCKER_PAUSE_CONTENT_EXPANSION}${DOCKER_EXIT_CONTENT_EXPANSION}' #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 815d620a5..350290d77 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -2119,15 +2119,8 @@ prompt_dir() { local content="${(pj.$sep.)parts}" if (( _POWERLEVEL9K_DIR_HYPERLINK && _p9k_term_has_href )) && [[ $_p9k__cwd == /* ]]; then - local header=$'%{\e]8;;file://'${${_p9k__cwd//\%/%%25}//'#'/%%23}$'\a%}' - local footer=$'%{\e]8;;\a%}' - if (( expand )); then - _p9k_escape $header - header=$_p9k__ret - _p9k_escape $footer - footer=$_p9k__ret - fi - content=$header$content$footer + _p9k_href $'file://'${${_p9k__cwd//\%/%%25}//'#'/%%23} $content $expand + content=$_p9k__ret fi (( expand )) && _p9k_prompt_length "${(e):-"\${\${_p9k__d::=0}+}$content"}" || _p9k__ret= @@ -2386,6 +2379,26 @@ _p9k_prompt_load_sync() { _p9k_worker_reply $REPLY } +function _p9k_href() { + local link=${${1//\%/%%25}//'#'/%%23} + local content=${2:-$1} + local expand=$3 + + local header=$'%{\e]8;;'${link}$'\a%}' + local footer=$'%{\e]8;;\a%}' + + if (( _p9k_term_has_href )) ; then + if (( expand )); then + _p9k_escape $header + header=$_p9k__ret + _p9k_escape $footer + footer=$_p9k__ret + fi + content=$header$content$footer + fi + _p9k__ret=$content +} + # Usage: _p9k_cached_cmd <0|1> [args...] # # The first argument says whether to capture stderr (1) or ignore it (0). @@ -6430,11 +6443,8 @@ function _p9k_clear_instant_prompt() { echo -E - "${(%):- * Zsh will start %Bquickly%b but prompt will %Bjump down%b after initialization.}" echo -E - "" echo -E - "${(%):-For details, see:}" - if (( _p9k_term_has_href )); then - echo - "${(%):-\e]8;;https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\ahttps://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\e]8;;\a}" - else - echo - "${(%):-https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt}" - fi + _p9k_href 'https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt' + echo -E - "$_p9k__ret" echo -E - "" echo - "${(%):-%3F-- console output produced during zsh initialization follows --%f}" echo -E - "" From db7b18c5d3657cafc068f0fe52ef50d09915faba Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Tue, 4 May 2021 00:54:27 -0400 Subject: [PATCH 08/12] make the POWERLEVEL9K_DIR_HYPERLINKs actually open in WSL. Add a setting POWERLEVEL9K_WSL_NETWORK_DRIVE to specify the wsl root, as well as recognizing /mnt/? and />/ --- config/p10k-classic.zsh | 7 +++++++ config/p10k-lean-8colors.zsh | 7 +++++++ config/p10k-lean.zsh | 7 +++++++ config/p10k-rainbow.zsh | 7 +++++++ internal/p10k.zsh | 12 +++++++++++- 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 045eb4bcc..f30db8b55 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -275,6 +275,13 @@ # the full directory that was used in previous commands. typeset -g POWERLEVEL9K_DIR_HYPERLINK=false + # If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work: + # You must also map this drive letter on the windows side: + # ``` + # net use L: \\wsl$\Ubuntu-20.04 /persistent:yes + # ``` + # typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L: + # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON # and POWERLEVEL9K_DIR_CLASSES below. typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index 948fd2f39..e9a84c215 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -269,6 +269,13 @@ # the full directory that was used in previous commands. typeset -g POWERLEVEL9K_DIR_HYPERLINK=false + # If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work: + # You must also map this drive letter on the windows side: + # ``` + # net use L: \\wsl$\Ubuntu-20.04 /persistent:yes + # ``` + # typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L: + # Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and # POWERLEVEL9K_DIR_CLASSES below. typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2 diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 6e0227631..37c8119b3 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -269,6 +269,13 @@ # the full directory that was used in previous commands. typeset -g POWERLEVEL9K_DIR_HYPERLINK=false + # If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work: + # You must also map this drive letter on the windows side: + # ``` + # net use L: \\wsl$\Ubuntu-20.04 /persistent:yes + # ``` + # typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L: + # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON # and POWERLEVEL9K_DIR_CLASSES below. typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index da1a0a49e..32daae986 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -275,6 +275,13 @@ # the full directory that was used in previous commands. typeset -g POWERLEVEL9K_DIR_HYPERLINK=false + # If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work: + # You must also map this drive letter on the windows side: + # ``` + # net use L: \\wsl$\Ubuntu-20.04 /persistent:yes + # ``` + # typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L: + # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON # and POWERLEVEL9K_DIR_CLASSES below. typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 350290d77..f8e3a713c 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -2119,7 +2119,17 @@ prompt_dir() { local content="${(pj.$sep.)parts}" if (( _POWERLEVEL9K_DIR_HYPERLINK && _p9k_term_has_href )) && [[ $_p9k__cwd == /* ]]; then - _p9k_href $'file://'${${_p9k__cwd//\%/%%25}//'#'/%%23} $content $expand + local dirpath=${${_p9k__cwd//\%/%%25}//'#'/%%23} + + if (( $+commands[wslpath] )); then + if [[ -n $_POWERLEVEL9K_WSL_NETWORK_DRIVE && $(wslpath -w ${_p9k__cwd}) == \\\\* ]]; then + dirpath=$_POWERLEVEL9K_WSL_NETWORK_DRIVE$dirpath + elif [[ $dirpath =~ '^(/(mnt/)*(.))/' ]]; then + dirpath=$match[3]:${dirpath:${#match[1]}} + fi + fi + + _p9k_href $'file://'$dirpath $content $expand content=$_p9k__ret fi From 2ba4756831b44ff3cbf00b02d26c1634d2368c9a Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Thu, 13 May 2021 02:12:45 -0400 Subject: [PATCH 09/12] add kali icon --- internal/icons.zsh | 1 + internal/wizard.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/internal/icons.zsh b/internal/icons.zsh index 3abf3aca9..03c0ecef2 100644 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -49,6 +49,7 @@ function _p9k_init_icons() { ANDROID_ICON '\uE270'$s #  LINUX_ICON '\uE271'$s #  LINUX_ARCH_ICON '\uE271'$s #  + LINUX_KALI_ICON '\u327F'$s # ㉿ LINUX_DEBIAN_ICON '\uE271'$s #  LINUX_RASPBIAN_ICON '\uE271'$s #  LINUX_UBUNTU_ICON '\uE271'$s #  diff --git a/internal/wizard.zsh b/internal/wizard.zsh index 793c8ef36..92bce3fb6 100644 --- a/internal/wizard.zsh +++ b/internal/wizard.zsh @@ -1083,6 +1083,7 @@ function os_icon_name() { fi case $os_release_id in *arch*) echo LINUX_ARCH_ICON;; + *kali*) echo LINUX_KALI_ICON;; *debian*) echo LINUX_DEBIAN_ICON;; *raspbian*) echo LINUX_RASPBIAN_ICON;; *ubuntu*) echo LINUX_UBUNTU_ICON;; From 76a85e052223d792e8735e93f1b4c507874411f1 Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Thu, 13 May 2021 02:31:21 -0400 Subject: [PATCH 10/12] add kali icon --- internal/icons.zsh | 7 ++++++- internal/p10k.zsh | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/icons.zsh b/internal/icons.zsh index 03c0ecef2..9d8f46f8e 100644 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -49,7 +49,7 @@ function _p9k_init_icons() { ANDROID_ICON '\uE270'$s #  LINUX_ICON '\uE271'$s #  LINUX_ARCH_ICON '\uE271'$s #  - LINUX_KALI_ICON '\u327F'$s # ㉿ + LINUX_KALI_ICON '\uE271'$s #  LINUX_DEBIAN_ICON '\uE271'$s #  LINUX_RASPBIAN_ICON '\uE271'$s #  LINUX_UBUNTU_ICON '\uE271'$s #  @@ -186,6 +186,7 @@ function _p9k_init_icons() { ANDROID_ICON '\uE17B'$s #  (doesn't always work) LINUX_ICON '\uF17C'$s #  LINUX_ARCH_ICON '\uF17C'$s #  + LINUX_KALI_ICON '\u327F'$s # ㉿ LINUX_DEBIAN_ICON '\uF17C'$s #  LINUX_RASPBIAN_ICON '\uF17C'$s #  LINUX_UBUNTU_ICON '\uF17C'$s #  @@ -323,6 +324,7 @@ function _p9k_init_icons() { FREEBSD_ICON '\U1F608'$q # 😈 LINUX_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}" LINUX_ARCH_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}" + LINUX_KALI_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}" LINUX_DEBIAN_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}" LINUX_RASPBIAN_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}" LINUX_UBUNTU_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}" @@ -453,6 +455,7 @@ function _p9k_init_icons() { FREEBSD_ICON '\UF30C ' #  ANDROID_ICON '\uF17B' #  LINUX_ARCH_ICON '\uF303' #  + LINUX_KALI_ICON '\u327F'$s # ㉿ LINUX_CENTOS_ICON '\uF304'$s #  LINUX_COREOS_ICON '\uF305'$s #  LINUX_DEBIAN_ICON '\uF306' #  @@ -584,6 +587,7 @@ function _p9k_init_icons() { ANDROID_ICON 'android' LINUX_ICON 'linux' LINUX_ARCH_ICON 'arch' + LINUX_KALI_ICON 'kali' LINUX_DEBIAN_ICON 'debian' LINUX_RASPBIAN_ICON 'pi' LINUX_UBUNTU_ICON 'ubuntu' @@ -716,6 +720,7 @@ function _p9k_init_icons() { ANDROID_ICON 'And' LINUX_ICON 'Lx' LINUX_ARCH_ICON 'Arc' + LINUX_KALI_ICON 'Kli' LINUX_DEBIAN_ICON 'Deb' LINUX_RASPBIAN_ICON 'RPi' LINUX_UBUNTU_ICON 'Ubu' diff --git a/internal/p10k.zsh b/internal/p10k.zsh index f8e3a713c..575f39776 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -8211,6 +8211,7 @@ function _p9k_init_cacheable() { fi case $os_release_id in *arch*) _p9k_set_os Linux LINUX_ARCH_ICON;; + *kali*) _p9k_set_os Linux LINUX_KALI_ICON;; *debian*) _p9k_set_os Linux LINUX_DEBIAN_ICON;; *raspbian*) _p9k_set_os Linux LINUX_RASPBIAN_ICON;; *ubuntu*) _p9k_set_os Linux LINUX_UBUNTU_ICON;; From 37b87d7e5e1e2474479c85126d2311b378c7d572 Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Thu, 3 Jun 2021 15:33:08 -0400 Subject: [PATCH 11/12] fix case where broken wsl docker install still generates output to stdout --- internal/p10k.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 575f39776..883f018d8 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1307,6 +1307,7 @@ function _p9k_prompt_docker_async() { # Minimize all use of subshells and command invocations in general. # Async is not a license to be needlessly slow. for line in ${(f)"$( docker ps -a --format 'table {{ .Status }}' 2>/dev/null)"}; do + if (( $? )); then break; fi if [[ "$line" == *(Paused)* ]]; then (( container_status_counts[P]++ )) else From 162e08dae56a1b06b9f0c3b39b6845bf6f927464 Mon Sep 17 00:00:00 2001 From: Richard Ziegler Date: Mon, 14 Feb 2022 18:02:29 -0500 Subject: [PATCH 12/12] remove vcs identitfication better left to the user --- internal/icons.zsh | 12 ++++++++++++ internal/p10k.zsh | 3 --- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/internal/icons.zsh b/internal/icons.zsh index 9d8f46f8e..7ad121892 100644 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -98,6 +98,8 @@ function _p9k_init_icons() { VCS_LOADING_ICON '' VCS_GIT_ICON '\uE20E ' #  VCS_GIT_GITHUB_ICON '\uE20E ' # + VCS_GIT_GITHUB2_ICON '\uE20E ' # + VCS_GIT_GITHUB3_ICON '\uE20E ' # VCS_GIT_BITBUCKET_ICON '\uE20E ' # VCS_GIT_GITLAB_ICON '\uE20E ' # VCS_HG_ICON '\uE1C3 ' #  @@ -231,6 +233,8 @@ function _p9k_init_icons() { VCS_LOADING_ICON '' VCS_GIT_ICON '\uF1D3 ' #  VCS_GIT_GITHUB_ICON '\uF113 ' #  + VCS_GIT_GITHUB2_ICON '\uF09B ' #  + VCS_GIT_GITHUB3_ICON '\uF092 ' #  VCS_GIT_BITBUCKET_ICON '\uF171 ' #  VCS_GIT_GITLAB_ICON '\uF296 ' #  VCS_HG_ICON '\uF0C3 ' #  @@ -369,6 +373,8 @@ function _p9k_init_icons() { VCS_LOADING_ICON '' VCS_GIT_ICON "${CODEPOINT_OF_AWESOME_GIT:+\\u$CODEPOINT_OF_AWESOME_GIT }" VCS_GIT_GITHUB_ICON "${CODEPOINT_OF_AWESOME_GITHUB_ALT:+\\u$CODEPOINT_OF_AWESOME_GITHUB_ALT }" + VCS_GIT_GITHUB2_ICON "${CODEPOINT_OF_AWESOME_GITHUB_ALT:+\\u$CODEPOINT_OF_AWESOME_GITHUB_ALT }" + VCS_GIT_GITHUB3_ICON "${CODEPOINT_OF_AWESOME_GITHUB_ALT:+\\u$CODEPOINT_OF_AWESOME_GITHUB_ALT }" VCS_GIT_BITBUCKET_ICON "${CODEPOINT_OF_AWESOME_BITBUCKET:+\\u$CODEPOINT_OF_AWESOME_BITBUCKET }" VCS_GIT_GITLAB_ICON "${CODEPOINT_OF_AWESOME_GITLAB:+\\u$CODEPOINT_OF_AWESOME_GITLAB }" VCS_HG_ICON "${CODEPOINT_OF_AWESOME_FLASK:+\\u$CODEPOINT_OF_AWESOME_FLASK }" @@ -501,6 +507,8 @@ function _p9k_init_icons() { VCS_LOADING_ICON '' VCS_GIT_ICON '\uF1D3 ' #  VCS_GIT_GITHUB_ICON '\uF113 ' #  + VCS_GIT_GITHUB2_ICON '\uF09B ' #  + VCS_GIT_GITHUB3_ICON '\uF092 ' #  VCS_GIT_BITBUCKET_ICON '\uE703 ' #  VCS_GIT_GITLAB_ICON '\uF296 ' #  VCS_HG_ICON '\uF0C3 ' #  @@ -632,6 +640,8 @@ function _p9k_init_icons() { VCS_LOADING_ICON '' VCS_GIT_ICON '' VCS_GIT_GITHUB_ICON '' + VCS_GIT_GITHUB2_ICON '' + VCS_GIT_GITHUB3_ICON '' VCS_GIT_BITBUCKET_ICON '' VCS_GIT_GITLAB_ICON '' VCS_HG_ICON '' @@ -765,6 +775,8 @@ function _p9k_init_icons() { VCS_LOADING_ICON '' VCS_GIT_ICON '' VCS_GIT_GITHUB_ICON '' + VCS_GIT_GITHUB2_ICON '' + VCS_GIT_GITHUB3_ICON '' VCS_GIT_BITBUCKET_ICON '' VCS_GIT_GITLAB_ICON '' VCS_HG_ICON '' diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 883f018d8..4828ef3cf 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -3682,8 +3682,6 @@ function +vi-vcs-detect-changes() { vcs_visual_identifier='VCS_GIT_GITHUB_ICON' elif [[ "$remote" =~ "bitbucket" ]] then vcs_visual_identifier='VCS_GIT_BITBUCKET_ICON' - elif [[ "$remote" =~ "stash" ]] then - vcs_visual_identifier='VCS_GIT_BITBUCKET_ICON' elif [[ "$remote" =~ "gitlab" ]] then vcs_visual_identifier='VCS_GIT_GITLAB_ICON' else @@ -3825,7 +3823,6 @@ function _p9k_vcs_icon() { case "$VCS_STATUS_REMOTE_URL" in *github*) _p9k__ret=VCS_GIT_GITHUB_ICON;; *bitbucket*) _p9k__ret=VCS_GIT_BITBUCKET_ICON;; - *stash*) _p9k__ret=VCS_GIT_BITBUCKET_ICON;; *gitlab*) _p9k__ret=VCS_GIT_GITLAB_ICON;; *) _p9k__ret=VCS_GIT_ICON;; esac