aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/p10k-classic.zsh31
-rw-r--r--config/p10k-lean.zsh32
-rwxr-xr-xinternal/icons.zsh2
-rwxr-xr-xinternal/p10k.zsh31
-rwxr-xr-xinternal/wizard.zsh14
5 files changed, 77 insertions, 33 deletions
diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh
index 4b6ce418..c51d9575 100644
--- a/config/p10k-classic.zsh
+++ b/config/p10k-classic.zsh
@@ -15,7 +15,7 @@ fi
() {
emulate -L zsh
- setopt no_unset
+ setopt no_unset extended_glob
zmodload zsh/langinfo
if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then
local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8}
@@ -263,7 +263,8 @@ fi
# Enable special styling for non-writable directories.
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true
- # Show this icon when the current directory is not writable. Empty for no icon.
+ # Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE
+ # above must be set to true for this parameter to have effect.
# typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# Custom prefix.
@@ -361,7 +362,7 @@ fi
# Install our own Git status formatter.
typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED}_CONTENT_EXPANSION=$vcs
# When Git status is being refreshed asynchronously, display the last known repo status in grey.
- typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION=${${vcs//\%f}//\%<->F}
+ typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION=${${${vcs//\%f}//\%<->F}//\%F\{(\#|)[[:xdigit:]]#(\\|)\}}
# Enable counters for staged, unstaged, etc.
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1
@@ -607,7 +608,14 @@ fi
# POWERLEVEL9K_KUBECONTEXT_CLASSES defines the context class. Patterns are tried in order. The
# first match wins.
#
- # For example, if your current kubernetes context is "deathray-testing/default", its class is TEST
+ # For example, given these settings:
+ #
+ # typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=(
+ # '*prod*' PROD
+ # '*test*' TEST
+ # '*' DEFAULT)
+ #
+ # If your current kubernetes context is "deathray-testing/default", its class is TEST
# because "deathray-testing/default" doesn't match the pattern '*prod*' but does match '*test*'.
#
# You can define different colors, icons and content expansions for different classes:
@@ -637,7 +645,8 @@ fi
# in the output of `kubectl config get-contexts`. If there is no
# namespace, the parameter is set to "default".
#
- # If the context points to GKE or EKS, the following extra parameters are available:
+ # If the context points to Google Kubernetes Engine (GKE) or Elastic Kubernetes Service (EKS),
+ # the following extra parameters are available:
#
# - P9K_KUBECONTEXT_CLOUD_NAME Either "gke" or "eks".
# - P9K_KUBECONTEXT_CLOUD_ACCOUNT Account/project ID.
@@ -683,16 +692,12 @@ fi
# Show battery in red when it's below this level and not connected to power supply.
typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20
typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=160
- # Show battery in green when it's charging.
- typeset -g POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND=2
- # Show battery in yellow when not connected to power supply.
+ # Show battery in green when it's charging or fully charged.
+ typeset -g POWERLEVEL9K_BATTERY_{CHARGING,CHARGED}_FOREGROUND=70
+ # Show battery in yellow when it's discharging.
typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=178
# Battery pictograms going from low to high level of charge.
- typeset -g POWERLEVEL9K_BATTERY_STAGES='▁▂▃▄▅▆▇'
- # Display battery pictogram without background.
- typeset -g POWERLEVEL9K_BATTERY_VISUAL_IDENTIFIER_EXPANSION='%k${P9K_VISUAL_IDENTIFIER}'
- # Don't show battery when it's fully charged and connected to power supply.
- typeset -g POWERLEVEL9K_BATTERY_CHARGED_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
+ typeset -g POWERLEVEL9K_BATTERY_STAGES=('%K{232}▁' '%K{232}▂' '%K{232}▃' '%K{232}▄' '%K{232}▅' '%K{232}▆' '%K{232}▇' '%K{232}█')
# Don't show the remaining time to charge/discharge.
typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false
diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh
index fa7ed9df..405e968d 100644
--- a/config/p10k-lean.zsh
+++ b/config/p10k-lean.zsh
@@ -1,4 +1,4 @@
-# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate
+# Config for Powerlevel10k with lean prompt style. Type `p10k configure` to generate
# your own config based on it.
#
# Tip: Looking for a nice color? Here's a one-liner to print colormap.
@@ -15,7 +15,7 @@ fi
() {
emulate -L zsh
- setopt no_unset
+ setopt no_unset extended_glob
zmodload zsh/langinfo
if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then
local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8}
@@ -245,7 +245,7 @@ fi
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE
# above must be set to true for this parameter to have effect.
- # POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ # typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# Custom prefix.
# typeset -g POWERLEVEL9K_DIR_PREFIX='%fin '
@@ -342,7 +342,7 @@ fi
# Install our own Git status formatter.
typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED}_CONTENT_EXPANSION=$vcs
# When Git status is being refreshed asynchronously, display the last known repo status in grey.
- typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION=${${vcs//\%f}//\%<->F}
+ typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION=${${${vcs//\%f}//\%<->F}//\%F\{(\#|)[[:xdigit:]]#(\\|)\}}
# Enable counters for staged, unstaged, etc.
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1
@@ -582,7 +582,14 @@ fi
# POWERLEVEL9K_KUBECONTEXT_CLASSES defines the context class. Patterns are tried in order. The
# first match wins.
#
- # For example, if your current kubernetes context is "deathray-testing/default", its class is TEST
+ # For example, given these settings:
+ #
+ # typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=(
+ # '*prod*' PROD
+ # '*test*' TEST
+ # '*' DEFAULT)
+ #
+ # If your current kubernetes context is "deathray-testing/default", its class is TEST
# because "deathray-testing/default" doesn't match the pattern '*prod*' but does match '*test*'.
#
# You can define different colors, icons and content expansions for different classes:
@@ -612,7 +619,8 @@ fi
# in the output of `kubectl config get-contexts`. If there is no
# namespace, the parameter is set to "default".
#
- # If the context points to GKE or EKS, the following extra parameters are available:
+ # If the context points to Google Kubernetes Engine (GKE) or Elastic Kubernetes Service (EKS),
+ # the following extra parameters are available:
#
# - P9K_KUBECONTEXT_CLOUD_NAME Either "gke" or "eks".
# - P9K_KUBECONTEXT_CLOUD_ACCOUNT Account/project ID.
@@ -664,16 +672,12 @@ fi
# Show battery in red when it's below this level and not connected to power supply.
typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20
typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=160
- # Show battery in green when it's charging.
- typeset -g POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND=70
- # Show battery in yellow when not connected to power supply.
+ # Show battery in green when it's charging or fully charged.
+ typeset -g POWERLEVEL9K_BATTERY_{CHARGING,CHARGED}_FOREGROUND=70
+ # Show battery in yellow when it's discharging.
typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=178
# Battery pictograms going from low to high level of charge.
- typeset -g POWERLEVEL9K_BATTERY_STAGES='▁▂▃▄▅▆▇'
- # Display battery pictogram on black background.
- typeset -g POWERLEVEL9K_BATTERY_VISUAL_IDENTIFIER_EXPANSION='%K{232}${P9K_VISUAL_IDENTIFIER}%k'
- # Don't show battery when it's fully charged and connected to power supply.
- typeset -g POWERLEVEL9K_BATTERY_CHARGED_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
+ typeset -g POWERLEVEL9K_BATTERY_STAGES=('%K{232}▁' '%K{232}▂' '%K{232}▃' '%K{232}▄' '%K{232}▅' '%K{232}▆' '%K{232}▇' '%K{232}█')
# Don't show the remaining time to charge/discharge.
typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false
diff --git a/internal/icons.zsh b/internal/icons.zsh
index c74fe909..cacbb535 100755
--- a/internal/icons.zsh
+++ b/internal/icons.zsh
@@ -432,7 +432,7 @@ function _p9k_init_icons() {
RIGHT_SUBSEGMENT_SEPARATOR '\uE0B3' # 
CARRIAGE_RETURN_ICON '\u21B5' # ↵
ROOT_ICON '\u26A1' # ⚡
- SUDO_ICON '\uE0A2' # 
+ SUDO_ICON ''
RUBY_ICON 'Ruby'
AWS_ICON 'AWS'
AWS_EB_ICON '\U1F331' # 🌱
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index e28bf616..96bee0bf 100755
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -922,7 +922,12 @@ prompt_battery() {
case "${${(s:; :)raw_data}[2]}" in
'charging'|'finishing charge'|'AC attached')
- state=CHARGING
+ if (( bat_percent == 100 )); then
+ state=CHARGED
+ remain=''
+ else
+ state=CHARGING
+ fi
;;
'discharging')
(( bat_percent < _POWERLEVEL9K_BATTERY_LOW_THRESHOLD )) && state=LOW || state=DISCONNECTED
@@ -3785,6 +3790,30 @@ _p9k_init_params() {
#
# These correspond to `java -fullversion` and `java -version` respectively.
_p9k_declare -b POWERLEVEL9K_JAVA_VERSION_FULL 1
+
+ local -i i=1
+ while (( i <= $#_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS )); do
+ local segment=${(U)_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[i]}
+ local var=POWERLEVEL9K_${segment}_LEFT_DISABLED
+ (( $+parameters[$var] )) || var=POWERLEVEL9K_${segment}_DISABLED
+ if [[ ${(P)var} == true ]]; then
+ _POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[i,i]=()
+ else
+ (( ++i ))
+ fi
+ done
+
+ local -i i=1
+ while (( i <= $#_POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS )); do
+ local segment=${(U)_POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[i]}
+ local var=POWERLEVEL9K_${segment}_RIGHT_DISABLED
+ (( $+parameters[$var] )) || var=POWERLEVEL9K_${segment}_DISABLED
+ if [[ ${(P)var} == true ]]; then
+ _POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[i,i]=()
+ else
+ (( ++i ))
+ fi
+ done
}
typeset -ga __p9k_wrapped_zle_widgets
diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index 9e5d4b8f..7210a318 100755
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -1217,17 +1217,23 @@ function generate_config() {
fi
if [[ $POWERLEVEL9K_MODE == compatible ]]; then
- # Many fonts don't have the gear icon.
+ # Many fonts don't have the gear or the lock icon.
sub BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION "'⇶'"
+ uncomment 'typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION'
+ sub DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION "'∅'"
fi
if [[ $POWERLEVEL9K_MODE == (awesome-patched|awesome-fontconfig) && $cap_python == 0 ]]; then
uncomment 'typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION'
uncomment 'typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION'
uncomment 'typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION'
- sub VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION '🐍'
- sub ANACONDA_VISUAL_IDENTIFIER_EXPANSION '🐍'
- sub PYENV_VISUAL_IDENTIFIER_EXPANSION '🐍'
+ sub VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION "'🐍'"
+ sub ANACONDA_VISUAL_IDENTIFIER_EXPANSION "'🐍'"
+ sub PYENV_VISUAL_IDENTIFIER_EXPANSION "'🐍'"
+ fi
+
+ if [[ $POWERLEVEL9K_MODE == nerdfont-complete ]]; then
+ sub BATTERY_STAGES "\$'\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578'"
fi
if [[ $style == classic ]]; then