better distinguish between fontawesome and nerd fonts

There are fonts that aren't from Nerd Fonts and that cannot display
the python logo from Font Awesome. Classify them as awesome-fontconfig
and manually set an alternative icon for all Python segments in the
config.

Fixes #157.
pull/186/head
romkatv 5 years ago
parent 429b07d4f8
commit 71a0b76ac0

@ -251,6 +251,33 @@ function ask_python() {
done done
} }
function ask_debian() {
while true; do
clear
centered "%BDoes this look like a %b%2FDebian logo%f%B (swirl/spiral)?%b"
centered "reference: $(href https://www.debian.org/logos/openlogo-nd-100.jpg)"
print -P ""
centered "---> \uF306 <---"
print -P ""
print -P "%B(y) Yes.%b"
print -P ""
print -P "%B(n) No.%b"
print -P ""
print -P "(r) Restart from the beginning."
print -P "(q) Quit and do nothing."
print -P ""
local key=
read -k key${(%):-"?%BChoice [ynrq]: %b"} || quit
case $key in
q) quit;;
r) return 1;;
y) cap_debian=1; break;;
n) cap_debian=0; break;;
esac
done
}
function ask_narrow_icons() { function ask_narrow_icons() {
if [[ $POWERLEVEL9K_MODE == (powerline|compatible) ]]; then if [[ $POWERLEVEL9K_MODE == (powerline|compatible) ]]; then
cap_narrow_icons=0 cap_narrow_icons=0
@ -882,6 +909,15 @@ function generate_config() {
sub BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION "'⇶'" sub BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION "'⇶'"
fi fi
if [[ $POWERLEVEL9K_MODE == awesome-fontconfig && $cap_python == 0 ]]; then
uncomment 'typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION'
uncomment 'typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION'
uncomment 'typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION'
sub VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION '🐍'
sub ANACONDA_VISUAL_IDENTIFIER_EXPANSION '🐍'
sub PYENV_VISUAL_IDENTIFIER_EXPANSION '🐍'
fi
if [[ $style == classic ]]; then if [[ $style == classic ]]; then
sub BACKGROUND $bg_color[$color] sub BACKGROUND $bg_color[$color]
sub MULTILINE_FIRST_PROMPT_GAP_FOREGROUND $frame_color[$color] sub MULTILINE_FIRST_PROMPT_GAP_FOREGROUND $frame_color[$color]
@ -1029,7 +1065,7 @@ while true; do
local POWERLEVEL9K_MODE= style= config_backup= config_backup_u= gap_char=' ' local POWERLEVEL9K_MODE= style= config_backup= config_backup_u= gap_char=' '
local left_subsep= right_subsep= left_tail= right_tail= left_head= right_head= local left_subsep= right_subsep= left_tail= right_tail= left_head= right_head=
local -i num_lines=0 write_config=0 empty_line=0 color=2 left_frame=1 right_frame=1 local -i num_lines=0 write_config=0 empty_line=0 color=2 left_frame=1 right_frame=1
local -i cap_diamond=0 cap_python=0 cap_narrow_icons=0 cap_lock=0 local -i cap_diamond=0 cap_python=0 cap_debian=0 cap_narrow_icons=0 cap_lock=0
local -a extra_icons=('' '' '') local -a extra_icons=('' '' '')
local -a prefixes=('' '') local -a prefixes=('' '')
local -a options=() local -a options=()
@ -1049,8 +1085,13 @@ while true; do
elif (( ! cap_diamond )); then elif (( ! cap_diamond )); then
POWERLEVEL9K_MODE=awesome-fontconfig POWERLEVEL9K_MODE=awesome-fontconfig
else else
ask_python || continue ask_debian || continue
(( cap_python )) && POWERLEVEL9K_MODE=awesome-fontconfig || POWERLEVEL9K_MODE=nerdfont-complete if (( cap_debian )); then
POWERLEVEL9K_MODE=nerdfont-complete
else
POWERLEVEL9K_MODE=awesome-fontconfig
ask_python || continue
fi
fi fi
fi fi
if [[ $POWERLEVEL9K_MODE == powerline ]]; then if [[ $POWERLEVEL9K_MODE == powerline ]]; then

Loading…
Cancel
Save