summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorMichael Louwrens <mlouwrens@entersekt.com>2018-02-10 20:46:31 +0300
committerMichael Louwrens <mlouwrens@entersekt.com>2018-02-10 20:46:31 +0300
commit7b8656f8e79fb369b91b93cb3cbbe437935bb893 (patch)
treeedb92953a453b2b7de1d6cd8097cd9e01777cbef /powerlevel9k.zsh-theme
parentfd3d2343547b07d74cb102dd843f8a54d9e0b79f (diff)
add sudo status to context and user prompts
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme11
1 files changed, 11 insertions, 0 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index c32ccd48..40b38a22 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -590,6 +590,7 @@ prompt_context() {
typeset -AH context_states
context_states=(
"ROOT" "yellow"
+ "SUDO" "yellow"
"DEFAULT" "yellow"
"REMOTE" "yellow"
)
@@ -608,6 +609,8 @@ prompt_context() {
current_state="ROOT"
elif [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then
current_state="REMOTE"
+ elif sudo -n uptime >/dev/null 2>&1; then
+ current_statue="SUDO"
fi
"$1_prompt_segment" "${0}_${current_state}" "$2" "$DEFAULT_COLOR" "${context_states[$current_state]}" "${content}"
@@ -629,6 +632,14 @@ prompt_user() {
"FOREGROUND_COLOR" "yellow"
"VISUAL_IDENTIFIER" "ROOT_ICON"
)
+ elif sudo -n uptime >/dev/null 2>&1; then
+ user_state=(
+ "STATE" "SUDO"
+ "CONTENT" "${POWERLEVEL9K_USER_TEMPLATE}"
+ "BACKGROUND_COLOR" "${DEFAULT_COLOR}"
+ "FOREGROUND_COLOR" "yellow"
+ "VISUAL_IDENTIFIER" "ROOT_ICON"
+ )
else
user_state=(
"STATE" "DEFAULT"