aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/p10k-classic.zsh11
-rw-r--r--config/p10k-lean-8colors.zsh11
-rw-r--r--config/p10k-lean.zsh11
-rw-r--r--config/p10k-rainbow.zsh12
-rw-r--r--internal/icons.zsh6
-rw-r--r--internal/p10k.zsh35
-rw-r--r--internal/wizard.zsh2
7 files changed, 85 insertions, 3 deletions
diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh
index 592d8a7b..e58108bd 100644
--- a/config/p10k-classic.zsh
+++ b/config/p10k-classic.zsh
@@ -76,6 +76,7 @@
azure # azure account name (https://docs.microsoft.com/en-us/cli/azure)
gcloud # google cloud cli account and project (https://cloud.google.com/)
google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production)
+ toolbox # toolbox name (https://github.com/containers/toolbox)
context # user@hostname
nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
ranger # ranger shell (https://github.com/ranger/ranger)
@@ -1449,6 +1450,16 @@
# Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced by '%%'.
typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}'
+ ##############[ toolbox: toolbox name (https://github.com/containers/toolbox) ]###############
+ # Toolbox color.
+ typeset -g POWERLEVEL9K_TOOLBOX_FOREGROUND=178
+ # Don't display the name of the toolbox if it matches fedora-toolbox-*.
+ typeset -g POWERLEVEL9K_TOOLBOX_CONTENT_EXPANSION='${P9K_TOOLBOX_NAME:#fedora-toolbox-*}'
+ # Custom icon.
+ # typeset -g POWERLEVEL9K_TOOLBOX_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ # Custom prefix.
+ # typeset -g POWERLEVEL9K_TOOLBOX_PREFIX='%248Fin '
+
###############################[ public_ip: public IP address ]###############################
# Public IP color.
typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=94
diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh
index 8e98757a..e0e6cc7f 100644
--- a/config/p10k-lean-8colors.zsh
+++ b/config/p10k-lean-8colors.zsh
@@ -76,6 +76,7 @@
azure # azure account name (https://docs.microsoft.com/en-us/cli/azure)
gcloud # google cloud cli account and project (https://cloud.google.com/)
google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production)
+ toolbox # toolbox name (https://github.com/containers/toolbox)
context # user@hostname
nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
ranger # ranger shell (https://github.com/ranger/ranger)
@@ -1430,6 +1431,16 @@
# Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced by '%%'.
typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}'
+ ##############[ toolbox: toolbox name (https://github.com/containers/toolbox) ]###############
+ # Toolbox color.
+ typeset -g POWERLEVEL9K_TOOLBOX_FOREGROUND=3
+ # Don't display the name of the toolbox if it matches fedora-toolbox-*.
+ typeset -g POWERLEVEL9K_TOOLBOX_CONTENT_EXPANSION='${P9K_TOOLBOX_NAME:#fedora-toolbox-*}'
+ # Custom icon.
+ # typeset -g POWERLEVEL9K_TOOLBOX_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ # Custom prefix.
+ # typeset -g POWERLEVEL9K_TOOLBOX_PREFIX='%fin '
+
###############################[ public_ip: public IP address ]###############################
# Public IP color.
typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=6
diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh
index 5bfd77cc..af802d16 100644
--- a/config/p10k-lean.zsh
+++ b/config/p10k-lean.zsh
@@ -76,6 +76,7 @@
azure # azure account name (https://docs.microsoft.com/en-us/cli/azure)
gcloud # google cloud cli account and project (https://cloud.google.com/)
google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production)
+ toolbox # toolbox name (https://github.com/containers/toolbox)
context # user@hostname
nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
ranger # ranger shell (https://github.com/ranger/ranger)
@@ -1426,6 +1427,16 @@
# Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced by '%%'.
typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}'
+ ##############[ toolbox: toolbox name (https://github.com/containers/toolbox) ]###############
+ # Toolbox color.
+ typeset -g POWERLEVEL9K_TOOLBOX_FOREGROUND=178
+ # Don't display the name of the toolbox if it matches fedora-toolbox-*.
+ typeset -g POWERLEVEL9K_TOOLBOX_CONTENT_EXPANSION='${P9K_TOOLBOX_NAME:#fedora-toolbox-*}'
+ # Custom icon.
+ # typeset -g POWERLEVEL9K_TOOLBOX_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ # Custom prefix.
+ # typeset -g POWERLEVEL9K_TOOLBOX_PREFIX='%fin '
+
###############################[ public_ip: public IP address ]###############################
# Public IP color.
typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=94
diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh
index a580f300..0c90ff98 100644
--- a/config/p10k-rainbow.zsh
+++ b/config/p10k-rainbow.zsh
@@ -76,6 +76,7 @@
azure # azure account name (https://docs.microsoft.com/en-us/cli/azure)
gcloud # google cloud cli account and project (https://cloud.google.com/)
google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production)
+ toolbox # toolbox name (https://github.com/containers/toolbox)
context # user@hostname
nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
ranger # ranger shell (https://github.com/ranger/ranger)
@@ -1527,6 +1528,17 @@
# Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced by '%%'.
typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}'
+ ##############[ toolbox: toolbox name (https://github.com/containers/toolbox) ]###############
+ # Toolbox color.
+ typeset -g POWERLEVEL9K_TOOLBOX_FOREGROUND=0
+ typeset -g POWERLEVEL9K_TOOLBOX_BACKGROUND=3
+ # Don't display the name of the toolbox if it matches fedora-toolbox-*.
+ typeset -g POWERLEVEL9K_TOOLBOX_CONTENT_EXPANSION='${P9K_TOOLBOX_NAME:#fedora-toolbox-*}'
+ # Custom icon.
+ # typeset -g POWERLEVEL9K_TOOLBOX_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ # Custom prefix.
+ # typeset -g POWERLEVEL9K_TOOLBOX_PREFIX='in '
+
###############################[ public_ip: public IP address ]###############################
# Public IP color.
typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=7
diff --git a/internal/icons.zsh b/internal/icons.zsh
index bf5a1a11..dfbe0a00 100644
--- a/internal/icons.zsh
+++ b/internal/icons.zsh
@@ -145,6 +145,7 @@ function _p9k_init_icons() {
PACKAGE_ICON 'pkg'
JULIA_ICON 'jl'
SCALA_ICON 'scala'
+ TOOLBOX_ICON '\u2B22' # ⬢
)
;;
'awesome-fontconfig')
@@ -274,6 +275,7 @@ function _p9k_init_icons() {
PACKAGE_ICON 'pkg'
JULIA_ICON 'jl'
SCALA_ICON 'scala'
+ TOOLBOX_ICON '\u2B22' # ⬢
)
;;
'awesome-mapped-fontconfig')
@@ -406,6 +408,7 @@ function _p9k_init_icons() {
PACKAGE_ICON 'pkg'
JULIA_ICON 'jl'
SCALA_ICON 'scala'
+ TOOLBOX_ICON '\u2B22' # ⬢
)
;;
'nerdfont-complete'|'nerdfont-fontconfig')
@@ -536,6 +539,7 @@ function _p9k_init_icons() {
PACKAGE_ICON '\uF8D6' # 
JULIA_ICON '\uE624' # 
SCALA_ICON '\uE737' # 
+ TOOLBOX_ICON '\uE20F'$s # 
)
;;
ascii)
@@ -663,6 +667,7 @@ function _p9k_init_icons() {
PACKAGE_ICON 'pkg'
JULIA_ICON 'jl'
SCALA_ICON 'scala'
+ TOOLBOX_ICON 'toolbox'
)
;;
*)
@@ -792,6 +797,7 @@ function _p9k_init_icons() {
PACKAGE_ICON 'pkg'
JULIA_ICON 'jl'
SCALA_ICON 'scala'
+ TOOLBOX_ICON '\u2B22' # ⬢
)
;;
esac
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index c50292f2..98090d99 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -1652,6 +1652,20 @@ prompt_host() {
instant_prompt_host() { prompt_host; }
################################################################
+# Toolbox: https://github.com/containers/toolbox
+function prompt_toolbox() {
+ _p9k_prompt_segment $0 $_p9k_color1 yellow TOOLBOX_ICON 0 '' $P9K_TOOLBOX_NAME
+}
+
+_p9k_prompt_toolbox_init() {
+ typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$P9K_TOOLBOX_NAME'
+}
+
+function instant_prompt_toolbox() {
+ _p9k_prompt_segment prompt_toolbox $_p9k_color1 yellow TOOLBOX_ICON 1 '$P9K_TOOLBOX_NAME' '$P9K_TOOLBOX_NAME'
+}
+
+################################################################
# The 'custom` prompt provides a way for users to invoke commands and display
# the output in a segment.
_p9k_custom_prompt() {
@@ -5906,7 +5920,7 @@ _p9k_set_instant_prompt() {
[[ -n $RPROMPT ]] || unset RPROMPT
}
-typeset -gri __p9k_instant_prompt_version=42
+typeset -gri __p9k_instant_prompt_version=43
_p9k_dump_instant_prompt() {
local user=${(%):-%n}
@@ -6117,6 +6131,9 @@ _p9k_dump_instant_prompt() {
unfunction p10k-on-post-widget'
fi
>&$fd print -r -- '
+ () {
+'$functions[_p9k_init_toolbox]'
+ }
trap "unset -m _p9k__\*; unfunction p10k" EXIT
local -a _p9k_t=("${(@ps:$us:)${tail%%$rs*}}")
if [[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]] && (( $+commands[stty] )); then
@@ -8123,6 +8140,17 @@ _p9k_init_ssh() {
[[ $w =~ "\(?($ipv4|$ipv6|$hostname)\)?\$" ]] && P9K_SSH=1
}
+_p9k_init_toolbox() {
+ [[ -z $P9K_TOOLBOX_NAME &&
+ -e /run/.toolboxenv &&
+ -f /run/.containerenv &&
+ -r /run/.containerenv ]] || return 0
+ local name=(${(Q)${${(@M)${(f)"$(</run/.containerenv)"}:#name=*}#name=}})
+ (( ${#name} == 1 )) || return 0
+ [[ -n ${name[1]} ]] || return 0
+ typeset -g P9K_TOOLBOX_NAME=${name[1]}
+}
+
_p9k_must_init() {
(( _POWERLEVEL9K_DISABLE_HOT_RELOAD && !_p9k__force_must_init )) && return 1
_p9k__force_must_init=0
@@ -8132,7 +8160,7 @@ _p9k_must_init() {
[[ $sig == $_p9k__param_sig ]] && return 1
_p9k_deinit
fi
- _p9k__param_pat=$'v125\1'${(q)ZSH_VERSION}$'\1'${(q)ZSH_PATCHLEVEL}$'\1'
+ _p9k__param_pat=$'v126\1'${(q)ZSH_VERSION}$'\1'${(q)ZSH_PATCHLEVEL}$'\1'
_p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
_p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'
_p9k__param_pat+=$'$GITSTATUS_CACHE_DIR\1$GITSTATUS_AUTO_INSTALL\1${ZLE_RPROMPT_INDENT:-1}\1'
@@ -8631,7 +8659,7 @@ _p9k_deinit() {
fi
(( $+_p9k__iterm2_precmd )) && functions[iterm2_precmd]=$_p9k__iterm2_precmd
(( $+_p9k__iterm2_decorate_prompt )) && functions[iterm2_decorate_prompt]=$_p9k__iterm2_decorate_prompt
- unset -m '(_POWERLEVEL9K_|P9K_|_p9k_)*~(P9K_SSH|P9K_TTY|_P9K_TTY)'
+ unset -m '(_POWERLEVEL9K_|P9K_|_p9k_)*~(P9K_SSH|P9K_TOOLBOX_NAME|P9K_TTY|_P9K_TTY)'
[[ -n $__p9k_locale ]] || unset __p9k_locale
}
@@ -9044,4 +9072,5 @@ if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file && -n $__p9k_instant_p
fi
_p9k_init_ssh
+_p9k_init_toolbox
prompt_powerlevel9k_setup
diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index 793c8ef3..c4c7a87c 100644
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -1767,6 +1767,7 @@ function generate_config() {
uncomment 'typeset -g POWERLEVEL9K_CONTEXT_PREFIX'
uncomment 'typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX'
uncomment 'typeset -g POWERLEVEL9K_TIME_PREFIX'
+ uncomment 'typeset -g POWERLEVEL9K_TOOLBOX_PREFIX'
if [[ $style == (lean|classic) ]]; then
[[ $style == classic ]] && local fg="%$prefix_color[$color]F" || local fg="%f"
sub VCS_PREFIX "'${fg}on '"
@@ -1774,6 +1775,7 @@ function generate_config() {
sub CONTEXT_PREFIX "'${fg}with '"
sub KUBECONTEXT_PREFIX "'${fg}at '"
sub TIME_PREFIX "'${fg}at '"
+ sub TOOLBOX_PREFIX "'${fg}in '"
fi
fi