From c5203a3da2a8814992c91b20f8246b19ea88401c Mon Sep 17 00:00:00 2001 From: brent-moffit <72231013+brent-moffit@users.noreply.github.com> Date: Wed, 2 Feb 2022 17:47:46 -0800 Subject: Add `arch` prompt for displaying CPU architecture Adds the `arch` prompt to `p10k.zsh`, `ARCH_ICON` to `icons.zsh`, and commented entries in the default configs --- internal/p10k.zsh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'internal/p10k.zsh') diff --git a/internal/p10k.zsh b/internal/p10k.zsh index e797a874..26e43eec 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -5625,6 +5625,21 @@ _p9k_prompt_haskell_stack_init() { typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[stack]' } +################################################################ +# CPU Architecture +prompt_arch() { + if ! _p9k_cache_ephemeral_get $0 ; then + _p9k_cache_ephemeral_set $(arch) + fi + [[ $_p9k__cache_val[1] == $POWERLEVEL9K_ARCH_DEFAULT ]] && return + _p9k_prompt_segment "$0" "orange1" "black" 'ARCH_ICON' 0 '' "$_p9k__cache_val[1]" +} + +_p9k_prompt_arch_init() { + echo 'arch init' >> ~/p9k_debug.txt + 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() { -- cgit v1.2.3 From 01467fae4f72dd1bf4b73708e6e356b5417dfc68 Mon Sep 17 00:00:00 2001 From: brent-moffit <72231013+brent-moffit@users.noreply.github.com> Date: Mon, 14 Feb 2022 12:27:56 -0800 Subject: Change arch prompt colors to better match default themes --- internal/p10k.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/p10k.zsh') diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 26e43eec..965fd816 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -5632,7 +5632,7 @@ prompt_arch() { _p9k_cache_ephemeral_set $(arch) fi [[ $_p9k__cache_val[1] == $POWERLEVEL9K_ARCH_DEFAULT ]] && return - _p9k_prompt_segment "$0" "orange1" "black" 'ARCH_ICON' 0 '' "$_p9k__cache_val[1]" + _p9k_prompt_segment "$0" "$_p9k_color1" "orange1" 'ARCH_ICON' 0 '' "$_p9k__cache_val[1]" } _p9k_prompt_arch_init() { -- cgit v1.2.3 From 59e90bd8b0bee6b00bc9153f13336f6cafeae08a Mon Sep 17 00:00:00 2001 From: brent-moffit <72231013+brent-moffit@users.noreply.github.com> Date: Mon, 14 Feb 2022 12:38:13 -0800 Subject: Add instant prompt for arch --- internal/p10k.zsh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'internal/p10k.zsh') diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 965fd816..2adbc40f 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -5635,6 +5635,8 @@ prompt_arch() { _p9k_prompt_segment "$0" "$_p9k_color1" "orange1" 'ARCH_ICON' 0 '' "$_p9k__cache_val[1]" } +instant_prompt_arch() { prompt_arch; } + _p9k_prompt_arch_init() { echo 'arch init' >> ~/p9k_debug.txt typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[arch]' -- cgit v1.2.3