Merge remote-tracking branch 'ben/next' into icon_protection2

pull/22/head
Dominik Ritter 9 years ago
commit d7e3cb31b8

@ -130,6 +130,8 @@ case $POWERLEVEL9K_MODE in
icons=( icons=(
LEFT_SEGMENT_SEPARATOR $'\UE0B0' #  LEFT_SEGMENT_SEPARATOR $'\UE0B0' # 
RIGHT_SEGMENT_SEPARATOR $'\UE0B2' #  RIGHT_SEGMENT_SEPARATOR $'\UE0B2' # 
LEFT_SUBSEGMENT_SEPARATOR $'\UE0B1' # 
RIGHT_SUBSEGMENT_SEPARATOR $'\UE0B3' # 
ROOT_ICON $'\UE801' #  ROOT_ICON $'\UE801' # 
RUBY_ICON $'\UE847' #  RUBY_ICON $'\UE847' # 
AWS_ICON $'\UE895' #  AWS_ICON $'\UE895' # 
@ -175,6 +177,8 @@ case $POWERLEVEL9K_MODE in
icons=( icons=(
LEFT_SEGMENT_SEPARATOR $'\uE0B0' #  LEFT_SEGMENT_SEPARATOR $'\uE0B0' # 
RIGHT_SEGMENT_SEPARATOR $'\uE0B2' #  RIGHT_SEGMENT_SEPARATOR $'\uE0B2' # 
LEFT_SUBSEGMENT_SEPARATOR $'\UE0B1' # 
RIGHT_SUBSEGMENT_SEPARATOR $'\UE0B3' # 
ROOT_ICON $'\u26A1' # ⚡ ROOT_ICON $'\u26A1' # ⚡
RUBY_ICON '' RUBY_ICON ''
AWS_ICON 'AWS:' AWS_ICON 'AWS:'
@ -376,6 +380,14 @@ left_prompt_segment() {
if [[ $CURRENT_BG != 'NONE' && $2 != $CURRENT_BG ]]; then if [[ $CURRENT_BG != 'NONE' && $2 != $CURRENT_BG ]]; then
# Middle segment # Middle segment
echo -n "%{$bg%F{$CURRENT_BG}%}$(print_icon 'LEFT_SEGMENT_SEPARATOR')%{$fg%} " echo -n "%{$bg%F{$CURRENT_BG}%}$(print_icon 'LEFT_SEGMENT_SEPARATOR')%{$fg%} "
elif [[ "$CURRENT_BG" == $2 ]]; then
# Middle segment with same color as previous segment
# We take the current foreground color as color for our
# subsegment (or the default color). This should have
# enough contrast.
local complement
[[ -n $3 ]] && complement=$3 || complement=$DEFAULT_COLOR
echo -n "%{$bg%F{$complement}%}$(print_icon 'LEFT_SUBSEGMENT_SEPARATOR')%{$fg%} "
else else
# First segment # First segment
echo -n "%{$bg%}%{$fg%} " echo -n "%{$bg%}%{$fg%} "
@ -395,6 +407,8 @@ left_prompt_end() {
CURRENT_BG='' CURRENT_BG=''
} }
CURRENT_RIGHT_BG='NONE'
# Begin a right prompt segment # Begin a right prompt segment
# Takes four arguments: # Takes four arguments:
# * $1: Name of the function that was orginally invoked (mandatory). # * $1: Name of the function that was orginally invoked (mandatory).
@ -417,8 +431,21 @@ right_prompt_segment() {
local bg fg local bg fg
[[ -n $2 ]] && bg="%K{$2}" || bg="%k" [[ -n $2 ]] && bg="%K{$2}" || bg="%k"
[[ -n $3 ]] && fg="%F{$3}" || fg="%f" [[ -n $3 ]] && fg="%F{$3}" || fg="%f"
if [[ "$CURRENT_RIGHT_BG" == $2 ]]; then
# Middle segment with same color as previous segment
# We take the current foreground color as color for our
# subsegment (or the default color). This should have
# enough contrast.
local complement
[[ -n $3 ]] && complement=$3 || complement=$DEFAULT_COLOR
echo -n "%F{$complement}$(print_icon 'RIGHT_SUBSEGMENT_SEPARATOR')%f%{$bg%}%{$fg%} "
else
echo -n "%F{$2}$(print_icon 'RIGHT_SEGMENT_SEPARATOR')%f%{$bg%}%{$fg%} " echo -n "%F{$2}$(print_icon 'RIGHT_SEGMENT_SEPARATOR')%f%{$bg%}%{$fg%} "
fi
[[ -n $4 ]] && echo -n "$4 %f" [[ -n $4 ]] && echo -n "$4 %f"
CURRENT_RIGHT_BG=$2
} }
################################################################ ################################################################
@ -672,7 +699,7 @@ prompt_longstatus() {
[[ "$UID" -eq 0 ]] && symbols+="%F{yellow} $(print_icon 'ROOT_ICON')%f" [[ "$UID" -eq 0 ]] && symbols+="%F{yellow} $(print_icon 'ROOT_ICON')%f"
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%F{cyan}$(print_icon 'BACKGROUND_JOBS_ICON')%f" [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%F{cyan}$(print_icon 'BACKGROUND_JOBS_ICON')%f"
[[ -n "$symbols" ]] && $1_prompt_segment "$0" "$bg" "$DEFAULT_COLOR" "$symbols" [[ -n "$symbols" ]] && $1_prompt_segment "$0" "$bg" "white" "$symbols"
} }
# Node version # Node version

Loading…
Cancel
Save