1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-14 00:50:08 +00:00

rename arch to cpu_arch and rewrite it (#1752)

This commit is contained in:
Roman Perepelitsa 2022-10-09 11:54:02 +02:00
parent f89b54faf2
commit bd0c9f4ec7
6 changed files with 71 additions and 33 deletions

View file

@ -95,7 +95,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli) todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/) timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/) taskwarrior # taskwarrior task count (https://taskwarrior.org/)
# arch # current CPU Architecture # cpu_arch # CPU architecture
# time # current time # time # current time
# =========================[ Line #2 ]========================= # =========================[ Line #2 ]=========================
newline # \n newline # \n
@ -861,6 +861,17 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' # 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: user@hostname ]##################################
# Context color when running with privileges. # Context color when running with privileges.
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178 typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178
@ -1561,10 +1572,6 @@
# P9K_WIFI_NOISE | noise in dBm, from -120 to 0 # P9K_WIFI_NOISE | noise in dBm, from -120 to 0
# P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE) # P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE)
##############################[ arch: current cup architecture ]##############################
# Default CPU Aricheture (section is hidden when current architecture matches default)
# typeset -g POWERLEVEL9K_ARCH_DEFAULT='i386'
####################################[ time: current time ]#################################### ####################################[ time: current time ]####################################
# Current time color. # Current time color.
typeset -g POWERLEVEL9K_TIME_FOREGROUND=66 typeset -g POWERLEVEL9K_TIME_FOREGROUND=66

View file

@ -94,7 +94,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli) todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/) timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/) taskwarrior # taskwarrior task count (https://taskwarrior.org/)
# arch # current CPU Architecture # cpu_arch # CPU architecture
# time # current time # time # current time
# =========================[ Line #2 ]========================= # =========================[ Line #2 ]=========================
newline # \n newline # \n
@ -842,6 +842,17 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' # 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: user@hostname ]##################################
# Context color when running with privileges. # Context color when running with privileges.
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1 typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1
@ -1542,10 +1553,6 @@
# P9K_WIFI_NOISE | noise in dBm, from -120 to 0 # P9K_WIFI_NOISE | noise in dBm, from -120 to 0
# P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE) # P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE)
##############################[ arch: current cup architecture ]##############################
# Default CPU Aricheture (section is hidden when current architecture matches default)
# typeset -g POWERLEVEL9K_ARCH_DEFAULT='i386'
####################################[ time: current time ]#################################### ####################################[ time: current time ]####################################
# Current time color. # Current time color.
typeset -g POWERLEVEL9K_TIME_FOREGROUND=6 typeset -g POWERLEVEL9K_TIME_FOREGROUND=6

View file

@ -94,7 +94,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli) todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/) timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/) taskwarrior # taskwarrior task count (https://taskwarrior.org/)
# arch # current CPU Architecture # cpu_arch # CPU architecture
# time # current time # time # current time
# =========================[ Line #2 ]========================= # =========================[ Line #2 ]=========================
newline newline
@ -838,6 +838,17 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' # 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: user@hostname ]##################################
# Context color when running with privileges. # Context color when running with privileges.
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178 typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178
@ -1538,10 +1549,6 @@
# P9K_WIFI_NOISE | noise in dBm, from -120 to 0 # P9K_WIFI_NOISE | noise in dBm, from -120 to 0
# P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE) # P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE)
##############################[ arch: current cup architecture ]##############################
# Default CPU Aricheture (section is hidden when current architecture matches default)
# typeset -g POWERLEVEL9K_ARCH_DEFAULT='i386'
####################################[ time: current time ]#################################### ####################################[ time: current time ]####################################
# Current time color. # Current time color.
typeset -g POWERLEVEL9K_TIME_FOREGROUND=66 typeset -g POWERLEVEL9K_TIME_FOREGROUND=66

View file

@ -95,7 +95,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli) todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/) timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/) taskwarrior # taskwarrior task count (https://taskwarrior.org/)
# arch # current CPU Architecture # cpu_arch # CPU architecture
# time # current time # time # current time
# =========================[ Line #2 ]========================= # =========================[ Line #2 ]=========================
newline newline
@ -896,6 +896,18 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' # 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: user@hostname ]##################################
# Context color when running with privileges. # Context color when running with privileges.
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1 typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1
@ -1646,10 +1658,6 @@
# P9K_WIFI_NOISE | noise in dBm, from -120 to 0 # P9K_WIFI_NOISE | noise in dBm, from -120 to 0
# P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE) # P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE)
##############################[ arch: current cup architecture ]##############################
# Default CPU Aricheture (section is hidden when current architecture matches default)
# typeset -g POWERLEVEL9K_ARCH_DEFAULT='i386'
####################################[ time: current time ]#################################### ####################################[ time: current time ]####################################
# Current time color. # Current time color.
typeset -g POWERLEVEL9K_TIME_FOREGROUND=0 typeset -g POWERLEVEL9K_TIME_FOREGROUND=0

View file

@ -148,7 +148,7 @@ function _p9k_init_icons() {
JULIA_ICON 'jl' JULIA_ICON 'jl'
SCALA_ICON 'scala' SCALA_ICON 'scala'
TOOLBOX_ICON '\u2B22' # ⬢ TOOLBOX_ICON '\u2B22' # ⬢
ARCH_ICON '\uE205' #  ARCH_ICON 'arch'
) )
;; ;;
'awesome-fontconfig') 'awesome-fontconfig')
@ -281,7 +281,7 @@ function _p9k_init_icons() {
JULIA_ICON 'jl' JULIA_ICON 'jl'
SCALA_ICON 'scala' SCALA_ICON 'scala'
TOOLBOX_ICON '\u2B22' # ⬢ TOOLBOX_ICON '\u2B22' # ⬢
ARCH_ICON '\uE205' #  ARCH_ICON 'arch'
) )
;; ;;
'awesome-mapped-fontconfig') 'awesome-mapped-fontconfig')
@ -417,7 +417,7 @@ function _p9k_init_icons() {
JULIA_ICON 'jl' JULIA_ICON 'jl'
SCALA_ICON 'scala' SCALA_ICON 'scala'
TOOLBOX_ICON '\u2B22' # ⬢ TOOLBOX_ICON '\u2B22' # ⬢
ARCH_ICON '\uE205' #  ARCH_ICON 'arch'
) )
;; ;;
'nerdfont-complete'|'nerdfont-fontconfig') 'nerdfont-complete'|'nerdfont-fontconfig')
@ -551,7 +551,7 @@ function _p9k_init_icons() {
JULIA_ICON '\uE624' #  JULIA_ICON '\uE624' # 
SCALA_ICON '\uE737' #  SCALA_ICON '\uE737' # 
TOOLBOX_ICON '\uE20F'$s #  TOOLBOX_ICON '\uE20F'$s # 
ARCH_ICON '\uE266' ARCH_ICON '\uE266' # 
) )
;; ;;
ascii) ascii)
@ -682,6 +682,7 @@ function _p9k_init_icons() {
JULIA_ICON 'jl' JULIA_ICON 'jl'
SCALA_ICON 'scala' SCALA_ICON 'scala'
TOOLBOX_ICON 'toolbox' TOOLBOX_ICON 'toolbox'
ARCH_ICON 'arch'
) )
;; ;;
*) *)
@ -814,7 +815,7 @@ function _p9k_init_icons() {
JULIA_ICON 'jl' JULIA_ICON 'jl'
SCALA_ICON 'scala' SCALA_ICON 'scala'
TOOLBOX_ICON '\u2B22' # ⬢ TOOLBOX_ICON '\u2B22' # ⬢
ARCH_ICON '\uE205' #  ARCH_ICON 'arch'
) )
;; ;;
esac esac

View file

@ -5646,18 +5646,26 @@ _p9k_prompt_haskell_stack_init() {
################################################################ ################################################################
# CPU Architecture # CPU Architecture
prompt_arch() { prompt_cpu_arch() {
if ! _p9k_cache_ephemeral_get $0 ; then local -i len=$#_p9k__prompt _p9k__has_upglob
_p9k_cache_ephemeral_set $(arch)
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 fi
[[ $_p9k__cache_val[1] == $POWERLEVEL9K_ARCH_DEFAULT ]] && return if [[ -n $text ]]; then
_p9k_prompt_segment "$0" "$_p9k_color1" "orange1" 'ARCH_ICON' 0 '' "$_p9k__cache_val[1]" _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]
} }
instant_prompt_arch() { prompt_arch; }
_p9k_prompt_arch_init() { _p9k_prompt_arch_init() {
echo 'arch init' >> ~/p9k_debug.txt
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[arch]' typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[arch]'
} }