From dfc7b8ed80082cc85ae08949db793aca2f0c3541 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Mon, 18 Dec 2017 00:02:51 +0100 Subject: [PATCH] Fix some regressions in Powerline theme --- themes/powerline/powerline.base.bash | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 00df7468..c352a87a 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -14,14 +14,19 @@ function set_color { } function __powerline_user_info_prompt { - local user_info=${USER} + local user_info="" local color=${USER_INFO_THEME_PROMPT_COLOR} + if [[ "${THEME_CHECK_SUDO}" = true ]]; then + if sudo -n uptime 2>&1 | grep -q "load"; then + color=${USER_INFO_THEME_PROMPT_COLOR_SUDO} + fi + fi + case "${POWERLINE_PROMPT_USER_INFO_MODE}" in "sudo") - if sudo -n true >/dev/null 2>&1; then - color=${USER_INFO_THEME_PROMPT_COLOR_SUDO} - user_info=${USER_INFO_SUDO_CHAR}${USER} + if [[ "${color}" = "${USER_INFO_THEME_PROMPT_COLOR_SUDO}" ]]; then + user_info="!" fi ;; *) @@ -87,10 +92,6 @@ function __powerline_scm_prompt { function __powerline_cwd_prompt { local cwd=$(pwd | sed "s|^${HOME}|~|") - #if [[ -n "${CWD_THEME_DIR_SEPARATOR}" ]]; then - # todo - #fi - echo "${cwd}|${CWD_THEME_PROMPT_COLOR}" }