diff --git a/themes/powerline-multiline/README.md b/themes/powerline-multiline/README.md index 49ccb9f6..604d66aa 100644 --- a/themes/powerline-multiline/README.md +++ b/themes/powerline-multiline/README.md @@ -43,6 +43,10 @@ export THEME_CLOCK_FORMAT="%H:%M:%S" The time/date is printed by the `date` command, so refer to its man page to change the format. +### Soft Separators + +Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them. + ### Segment Order The contents of both prompt sides can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: diff --git a/themes/powerline-multiline/powerline-multiline.base.bash b/themes/powerline-multiline/powerline-multiline.base.bash index ac442f73..ea8b2624 100644 --- a/themes/powerline-multiline/powerline-multiline.base.bash +++ b/themes/powerline-multiline/powerline-multiline.base.bash @@ -9,6 +9,7 @@ function __powerline_right_segment { local params=( $1 ) IFS="${OLD_IFS}" local separator_char="${POWERLINE_RIGHT_SEPARATOR}" + local separator_char_soft="${POWERLINE_RIGHT_SEPARATOR_SOFT}" local padding="${POWERLINE_PADDING}" local separator_color="" @@ -16,7 +17,12 @@ function __powerline_right_segment { separator_char="${POWERLINE_RIGHT_END}" separator_color="$(set_color ${params[1]} -)" else - separator_color="$(set_color ${params[1]} ${LAST_SEGMENT_COLOR})" + if [[ "${LAST_SEGMENT_COLOR}" -eq "${params[1]}" ]]; then + separator_color="$(set_color - ${LAST_SEGMENT_COLOR})" + separator_char=${separator_char_soft} + else + separator_color="$(set_color ${params[1]} ${LAST_SEGMENT_COLOR})" + fi (( padding += 1 )) fi RIGHT_PROMPT+="${separator_color}${separator_char}${normal}$(set_color - ${params[1]}) ${params[0]} ${normal}$(set_color - ${COLOR})${normal}" diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index a70a2025..a726c8df 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -4,7 +4,9 @@ PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:="❯"} POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} +POWERLINE_LEFT_SEPARATOR_SOFT=${POWERLINE_LEFT_SEPARATOR_SOFT:=""} POWERLINE_RIGHT_SEPARATOR=${POWERLINE_RIGHT_SEPARATOR:=""} +POWERLINE_RIGHT_SEPARATOR_SOFT=${POWERLINE_RIGHT_SEPARATOR_SOFT:=""} POWERLINE_LEFT_END=${POWERLINE_LEFT_END:=""} POWERLINE_RIGHT_END=${POWERLINE_RIGHT_END:=""} POWERLINE_PADDING=${POWERLINE_PADDING:=2} diff --git a/themes/powerline/README.md b/themes/powerline/README.md index 55efa655..20d0bdd9 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -42,6 +42,10 @@ You can change the format using the following variable: The time/date is printed by the `date` command, so refer to its man page to change the format. +### Soft Separators + +Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them. + ### Segment Order The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index f5cf4f3e..058569c2 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -175,10 +175,15 @@ function __powerline_left_segment { local params=( $1 ) IFS="${OLD_IFS}" local separator_char="${POWERLINE_LEFT_SEPARATOR}" + local separator_char_soft="${POWERLINE_LEFT_SEPARATOR_SOFT}" local separator="" if [[ "${SEGMENTS_AT_LEFT}" -gt 0 ]]; then - separator="$(set_color ${LAST_SEGMENT_COLOR} ${params[1]})${separator_char}${normal}" + if [[ "${LAST_SEGMENT_COLOR}" -eq "${params[1]}" ]]; then + separator="$(set_color - ${LAST_SEGMENT_COLOR})${separator_char_soft}${normal}" + else + separator="$(set_color ${LAST_SEGMENT_COLOR} ${params[1]})${separator_char}${normal}" + fi fi LEFT_PROMPT+="${separator}$(set_color - ${params[1]}) ${params[0]} ${normal}" LAST_SEGMENT_COLOR=${params[1]} diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index d4bb387d..38e1ef1b 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -4,6 +4,7 @@ PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} +POWERLINE_LEFT_SEPARATOR_SOFT=${POWERLINE_LEFT_SEPARATOR_SOFT:=""} USER_INFO_SSH_CHAR=${POWERLINE_USER_INFO_SSH_CHAR:=" "} USER_INFO_THEME_PROMPT_COLOR=${POWERLINE_USER_INFO_COLOR:=32}