mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-26 05:50:07 +00:00
Use SUDO_COMMAND to check for sudo
`sudo -n true` only checks that we _could_ use `sudo`, not if we are in a sudo session. closes #852
This commit is contained in:
parent
571a859413
commit
3fb0383956
1 changed files with 3 additions and 3 deletions
|
@ -623,12 +623,12 @@ prompt_context() {
|
||||||
if [[ $(print -P "%#") == '#' ]]; then
|
if [[ $(print -P "%#") == '#' ]]; then
|
||||||
current_state="ROOT"
|
current_state="ROOT"
|
||||||
elif [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then
|
elif [[ -n "$SSH_CLIENT" || -n "$SSH_TTY" ]]; then
|
||||||
if sudo -n true 2>/dev/null; then
|
if [[ -n "$SUDO_COMMAND" ]]; then
|
||||||
current_state="REMOTE_SUDO"
|
current_state="REMOTE_SUDO"
|
||||||
else
|
else
|
||||||
current_state="REMOTE"
|
current_state="REMOTE"
|
||||||
fi
|
fi
|
||||||
elif sudo -n true 2>/dev/null; then
|
elif [[ -n "$SUDO_COMMAND" ]]; then
|
||||||
current_state="SUDO"
|
current_state="SUDO"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ prompt_user() {
|
||||||
"FOREGROUND_COLOR" "yellow"
|
"FOREGROUND_COLOR" "yellow"
|
||||||
"VISUAL_IDENTIFIER" "ROOT_ICON"
|
"VISUAL_IDENTIFIER" "ROOT_ICON"
|
||||||
)
|
)
|
||||||
elif sudo -n true 2>/dev/null; then
|
elif [[ -n "$SUDO_COMMAND" ]]; then
|
||||||
user_state=(
|
user_state=(
|
||||||
"STATE" "SUDO"
|
"STATE" "SUDO"
|
||||||
"CONTENT" "${POWERLEVEL9K_USER_TEMPLATE}"
|
"CONTENT" "${POWERLEVEL9K_USER_TEMPLATE}"
|
||||||
|
|
Loading…
Reference in a new issue