Skip to content

Commit

Permalink
style(themes/powerline-icon): adjust styles
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Sep 10, 2024
1 parent 2428b27 commit c0230dc
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions themes/powerline-icon/powerline-icon.base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,41 @@ source "$OSH/themes/powerline/powerline.base.sh"

function __powerline_user_info_prompt {
local user_info=""
local color=${USER_INFO_THEME_PROMPT_COLOR}
local secondary_color="${USER_INFO_THEME_PROMPT_SECONDARY_COLOR}"
local color=$USER_INFO_THEME_PROMPT_COLOR
local secondary_color=$USER_INFO_THEME_PROMPT_SECONDARY_COLOR

if [[ "${THEME_CHECK_SUDO}" = true ]]; then
if [[ $THEME_CHECK_SUDO == true ]]; then
# check whether sudo is active for no-password executions
if sudo -n cat <<< c3bcc5c 2>&1 | grep -q c3bcc5c; then
color=${USER_INFO_THEME_PROMPT_COLOR_SUDO}
fi
fi
case "${POWERLINE_PROMPT_USER_INFO_MODE}" in
case $POWERLINE_PROMPT_USER_INFO_MODE in
"sudo")
if [[ "${color}" == "${USER_INFO_THEME_PROMPT_COLOR_SUDO}" ]]; then
if [[ $color == "$USER_INFO_THEME_PROMPT_COLOR_SUDO" ]]; then
user_info="!"
fi
;;
*)
if [[ -n "${SSH_CLIENT}" ]]; then
user_info="${USER_INFO_SSH_CHAR}${USER}@${HOSTNAME}"
if [[ $SSH_CLIENT ]]; then
user_info=$USER_INFO_SSH_CHAR$USER@$HOSTNAME
else
user_info="${USER}"
user_info=$USER
fi
;;
esac
if [[ -n "${user_info}" ]]; then
if [[ $user_info ]]; then
local clock=$(date +"${OMB_THEME_POWERLINE_ICON_CLOCK-%X %D}")
_omb_util_print "$OMB_THEME_POWERLINE_ICON_USER ${user_info}${clock:+ $clock}|${color}|${secondary_color}"
_omb_util_print "$OMB_THEME_POWERLINE_ICON_USER $user_info${clock:+ $clock}|$color|$secondary_color"
fi
}

function __powerline_cwd_prompt {
_omb_util_print "$(pwd | sed "s|^${HOME}|$OMB_THEME_POWERLINE_ICON_HOME|")|${CWD_THEME_PROMPT_COLOR}"
_omb_util_print "$(pwd | sed "s|^$HOME|$OMB_THEME_POWERLINE_ICON_HOME|")|$CWD_THEME_PROMPT_COLOR"
}

function __powerline_last_status_prompt {
if [[ "$1" -ne 0 ]]; then
if (($1 != 0)); then
_omb_util_print "$OMB_THEME_POWERLINE_ICON_EXIT_FAILURE${1}|${LAST_STATUS_THEME_PROMPT_COLOR}"
else
_omb_util_print "$OMB_THEME_POWERLINE_ICON_EXIT_SUCCESS|${LAST_STATUS_THEME_PROMPT_COLOR_SUCCESS}"
Expand Down

0 comments on commit c0230dc

Please sign in to comment.