Merge pull request #1445 from davidpfarrell/soft-separator

Adds soft-separator support to powerline main + multiline themes
pull/1442/head
Nils Winkler 2019-12-28 13:15:21 +01:00 committed by GitHub
commit 1383af0ca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 2 deletions

View File

@ -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. 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 ### 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: 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:

View File

@ -9,14 +9,20 @@ function __powerline_right_segment {
local params=( $1 ) local params=( $1 )
IFS="${OLD_IFS}" IFS="${OLD_IFS}"
local separator_char="${POWERLINE_RIGHT_SEPARATOR}" local separator_char="${POWERLINE_RIGHT_SEPARATOR}"
local separator_char_soft="${POWERLINE_RIGHT_SEPARATOR_SOFT}"
local padding="${POWERLINE_PADDING}" local padding="${POWERLINE_PADDING}"
local separator_color="" local separator_color=""
if [[ "${SEGMENTS_AT_RIGHT}" -eq 0 ]]; then if [[ "${SEGMENTS_AT_RIGHT}" -eq 0 ]]; then
separator_char="${POWERLINE_RIGHT_END}" separator_char="${POWERLINE_RIGHT_END}"
separator_color="$(set_color ${params[1]} -)" separator_color="$(set_color ${params[1]} -)"
else
if [[ "${LAST_SEGMENT_COLOR}" -eq "${params[1]}" ]]; then
separator_color="$(set_color - ${LAST_SEGMENT_COLOR})"
separator_char=${separator_char_soft}
else else
separator_color="$(set_color ${params[1]} ${LAST_SEGMENT_COLOR})" separator_color="$(set_color ${params[1]} ${LAST_SEGMENT_COLOR})"
fi
(( padding += 1 )) (( padding += 1 ))
fi fi
RIGHT_PROMPT+="${separator_color}${separator_char}${normal}$(set_color - ${params[1]}) ${params[0]} ${normal}$(set_color - ${COLOR})${normal}" RIGHT_PROMPT+="${separator_color}${separator_char}${normal}$(set_color - ${params[1]}) ${params[0]} ${normal}$(set_color - ${COLOR})${normal}"

View File

@ -4,7 +4,9 @@
PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""}
POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""}
POWERLINE_LEFT_SEPARATOR_SOFT=${POWERLINE_LEFT_SEPARATOR_SOFT:=""}
POWERLINE_RIGHT_SEPARATOR=${POWERLINE_RIGHT_SEPARATOR:=""} POWERLINE_RIGHT_SEPARATOR=${POWERLINE_RIGHT_SEPARATOR:=""}
POWERLINE_RIGHT_SEPARATOR_SOFT=${POWERLINE_RIGHT_SEPARATOR_SOFT:=""}
POWERLINE_LEFT_END=${POWERLINE_LEFT_END:=""} POWERLINE_LEFT_END=${POWERLINE_LEFT_END:=""}
POWERLINE_RIGHT_END=${POWERLINE_RIGHT_END:=""} POWERLINE_RIGHT_END=${POWERLINE_RIGHT_END:=""}
POWERLINE_PADDING=${POWERLINE_PADDING:=2} POWERLINE_PADDING=${POWERLINE_PADDING:=2}

View File

@ -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. 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 ### 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: The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are:

View File

@ -175,11 +175,16 @@ function __powerline_left_segment {
local params=( $1 ) local params=( $1 )
IFS="${OLD_IFS}" IFS="${OLD_IFS}"
local separator_char="${POWERLINE_LEFT_SEPARATOR}" local separator_char="${POWERLINE_LEFT_SEPARATOR}"
local separator_char_soft="${POWERLINE_LEFT_SEPARATOR_SOFT}"
local separator="" local separator=""
if [[ "${SEGMENTS_AT_LEFT}" -gt 0 ]]; then if [[ "${SEGMENTS_AT_LEFT}" -gt 0 ]]; then
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}" separator="$(set_color ${LAST_SEGMENT_COLOR} ${params[1]})${separator_char}${normal}"
fi fi
fi
LEFT_PROMPT+="${separator}$(set_color - ${params[1]}) ${params[0]} ${normal}" LEFT_PROMPT+="${separator}$(set_color - ${params[1]}) ${params[0]} ${normal}"
LAST_SEGMENT_COLOR=${params[1]} LAST_SEGMENT_COLOR=${params[1]}
(( SEGMENTS_AT_LEFT += 1 )) (( SEGMENTS_AT_LEFT += 1 ))

View File

@ -4,6 +4,7 @@
PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""}
POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} 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_SSH_CHAR=${POWERLINE_USER_INFO_SSH_CHAR:=" "}
USER_INFO_THEME_PROMPT_COLOR=${POWERLINE_USER_INFO_COLOR:=32} USER_INFO_THEME_PROMPT_COLOR=${POWERLINE_USER_INFO_COLOR:=32}