diff options
-rw-r--r-- | config/p10k-classic.zsh | 12 | ||||
-rw-r--r-- | config/p10k-lean-8colors.zsh | 12 | ||||
-rw-r--r-- | config/p10k-lean.zsh | 12 | ||||
-rw-r--r-- | config/p10k-rainbow.zsh | 13 | ||||
-rw-r--r-- | gitstatus/README.md | 5 | ||||
-rw-r--r-- | internal/icons.zsh | 6 | ||||
-rw-r--r-- | internal/p10k.zsh | 25 |
7 files changed, 83 insertions, 2 deletions
diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 459c243b..24c4022b 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -95,6 +95,7 @@ todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) + # cpu_arch # CPU architecture # time # current time # =========================[ Line #2 ]========================= newline # \n @@ -860,6 +861,17 @@ # Custom icon. # typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' + ################################[ cpu_arch: CPU architecture ]################################ + # CPU architecture color. + typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=172 + + # Hide the segment when on a specific CPU architecture. + # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_CONTENT_EXPANSION= + # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_VISUAL_IDENTIFIER_EXPANSION= + + # Custom icon. + # typeset -g POWERLEVEL9K_CPU_ARCH_VISUAL_IDENTIFIER_EXPANSION='⭐' + ##################################[ context: user@hostname ]################################## # Context color when running with privileges. typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178 diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index 8157875a..1d2962a0 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -94,6 +94,7 @@ todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) + # cpu_arch # CPU architecture # time # current time # =========================[ Line #2 ]========================= newline # \n @@ -841,6 +842,17 @@ # Custom icon. # typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' + ################################[ cpu_arch: CPU architecture ]################################ + # CPU architecture color. + typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=3 + + # Hide the segment when on a specific CPU architecture. + # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_CONTENT_EXPANSION= + # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_VISUAL_IDENTIFIER_EXPANSION= + + # Custom icon. + # typeset -g POWERLEVEL9K_CPU_ARCH_VISUAL_IDENTIFIER_EXPANSION='⭐' + ##################################[ context: user@hostname ]################################## # Context color when running with privileges. typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1 diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 90953751..98bb8145 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -94,6 +94,7 @@ todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) + # cpu_arch # CPU architecture # time # current time # =========================[ Line #2 ]========================= newline @@ -837,6 +838,17 @@ # Custom icon. # typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' + ################################[ cpu_arch: CPU architecture ]################################ + # CPU architecture color. + typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=172 + + # Hide the segment when on a specific CPU architecture. + # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_CONTENT_EXPANSION= + # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_VISUAL_IDENTIFIER_EXPANSION= + + # Custom icon. + # typeset -g POWERLEVEL9K_CPU_ARCH_VISUAL_IDENTIFIER_EXPANSION='⭐' + ##################################[ context: user@hostname ]################################## # Context color when running with privileges. typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178 diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index 2f13370b..c12c286c 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -95,6 +95,7 @@ todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) + # cpu_arch # CPU architecture # time # current time # =========================[ Line #2 ]========================= newline @@ -895,6 +896,18 @@ # Custom icon. # typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' + ################################[ cpu_arch: CPU architecture ]################################ + # CPU architecture color. + typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=0 + typeset -g POWERLEVEL9K_CPU_ARCH_BACKGROUND=3 + + # Hide the segment when on a specific CPU architecture. + # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_CONTENT_EXPANSION= + # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_VISUAL_IDENTIFIER_EXPANSION= + + # Custom icon. + # typeset -g POWERLEVEL9K_CPU_ARCH_VISUAL_IDENTIFIER_EXPANSION='⭐' + ##################################[ context: user@hostname ]################################## # Context color when running with privileges. typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1 diff --git a/gitstatus/README.md b/gitstatus/README.md index b8d86163..82a19981 100644 --- a/gitstatus/README.md +++ b/gitstatus/README.md @@ -22,7 +22,8 @@ Bash bindings for integration with shell. The easiest way to take advantage of gitstatus from Zsh is to use a theme that's already integrated with it. For example, [Powerlevel10k](https://github.com/romkatv/powerlevel10k) is a flexible and -fast theme with first-class gitstatus integration. +fast theme with first-class gitstatus integration. If you install Powerlevel10k, you don't need to +install gitstatus. ![Powerlevel10k Zsh Theme]( https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/prompt-styles-high-contrast.png) @@ -491,7 +492,7 @@ cd gitstatus ./build -w -s -d docker ``` -Users in mainland China can use the official mirror on gitee.com for faster download.<br> +Users in China can use the official mirror on gitee.com for faster download.<br> 中国大陆用户可以使用 gitee.com 上的官方镜像加速下载. ```zsh diff --git a/internal/icons.zsh b/internal/icons.zsh index e3d71ffa..d38cf7bd 100644 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -148,6 +148,7 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' TOOLBOX_ICON '\u2B22' # ⬢ + ARCH_ICON 'arch' ) ;; 'awesome-fontconfig') @@ -280,6 +281,7 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' TOOLBOX_ICON '\u2B22' # ⬢ + ARCH_ICON 'arch' ) ;; 'awesome-mapped-fontconfig') @@ -415,6 +417,7 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' TOOLBOX_ICON '\u2B22' # ⬢ + ARCH_ICON 'arch' ) ;; 'nerdfont-complete'|'nerdfont-fontconfig') @@ -548,6 +551,7 @@ function _p9k_init_icons() { JULIA_ICON '\uE624' # SCALA_ICON '\uE737' # TOOLBOX_ICON '\uE20F'$s # + ARCH_ICON '\uE266' # ) ;; ascii) @@ -678,6 +682,7 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' TOOLBOX_ICON 'toolbox' + ARCH_ICON 'arch' ) ;; *) @@ -810,6 +815,7 @@ function _p9k_init_icons() { JULIA_ICON 'jl' SCALA_ICON 'scala' TOOLBOX_ICON '\u2B22' # ⬢ + ARCH_ICON 'arch' ) ;; esac diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 08aacf79..b21b57bf 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -5644,6 +5644,31 @@ _p9k_prompt_haskell_stack_init() { typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[stack]' } +################################################################ +# CPU Architecture +prompt_cpu_arch() { + local -i len=$#_p9k__prompt _p9k__has_upglob + + local state text + if _p9k_cache_ephemeral_get $0; then + state=$_p9k__cache_val[1] + text=$_p9k__cache_val[2] + else + text=$(command arch) 2>/dev/null && [[ $text == [a-zA-Z][a-zA-Z0-9_]# ]] || text= + state=_${(U)text} + _p9k_cache_ephemeral_set "$state" "$text" + fi + if [[ -n $text ]]; then + _p9k_prompt_segment "$0$state" "yellow" "$_p9k_color1" 'ARCH_ICON' 0 '' "$text" + fi + + (( _p9k__has_upglob )) || typeset -g "_p9k__segment_val_${_p9k__prompt_side}[_p9k__segment_index]"=$_p9k__prompt[len+1,-1] +} + +_p9k_prompt_arch_init() { + typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[arch]' +} + # Use two preexec hooks to survive https://github.com/MichaelAquilina/zsh-you-should-use with # YSU_HARDCORE=1. See https://github.com/romkatv/powerlevel10k/issues/427. _p9k_preexec1() { |