aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/icons.zsh6
-rw-r--r--internal/p10k.zsh25
2 files changed, 31 insertions, 0 deletions
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() {