wizard: detect POWERLEVEL9K_MODE=nerdfont-v3

This is Step 2 of https://github.com/romkatv/powerlevel10k/issues/2217#issuecomment-1493271666.
This commit is contained in:
Roman Perepelitsa 2023-04-02 14:22:01 +02:00
parent 6314edf35c
commit d031df752b

View file

@ -766,11 +766,12 @@ function ask_quotes() {
return 0 return 0
} }
function ask_debian() { function ask_arrow() {
add_widget 0 flowing -c %BDoes this look like a%b "%2FDebian logo%f" "%B(swirl/spiral)?%b" [[ -n $2 ]] && add_widget 0 flowing -c "$2"
add_widget 0 flowing -c reference: "$(href https://debian.org/logos/openlogo-nd.svg)" add_widget 0 flowing -c %BDoes this look like an%b "%2Fupwards arrow%f%B?%b"
add_widget 0 flowing -c reference: "$(href https://graphemica.com/%F0%9F%A0%89)"
add_widget 0 print -P "" add_widget 0 print -P ""
add_widget 0 flowing -c -- "---> \uF306 <---" add_widget 0 flowing -c -- "---> $1 <---"
add_widget 0 print -P "" add_widget 0 print -P ""
add_widget 3 add_widget 3
add_widget 0 print -P "%B(y) Yes.%b" add_widget 0 print -P "%B(y) Yes.%b"
@ -783,8 +784,8 @@ function ask_debian() {
ask ynr ask ynr
case $choice in case $choice in
r) return 1;; r) return 1;;
y) cap_debian=1;; y) cap_arrow=1;;
n) cap_debian=0;; n) cap_arrow=0;;
esac esac
return 0 return 0
} }
@ -910,7 +911,7 @@ function ask_charset() {
POWERLEVEL9K_ICON_PADDING=none POWERLEVEL9K_ICON_PADDING=none
cap_diamond=0 cap_diamond=0
cap_python=0 cap_python=0
cap_debian=0 cap_arrow=0
cap_lock=0 cap_lock=0
cap_quotes=0 cap_quotes=0
;; ;;
@ -1721,9 +1722,14 @@ function generate_config() {
sub PYTHON_ICON "'🐍'" sub PYTHON_ICON "'🐍'"
fi fi
if [[ $POWERLEVEL9K_MODE == nerdfont-complete ]]; then case $POWERLEVEL9K_MODE in
sub BATTERY_STAGES "'\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578'" nerdfont-complete)
fi sub BATTERY_STAGES "'\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578'"
;;
nerdfont-v3)
sub BATTERY_STAGES "'\UF008E\UF007A\UF007B\UF007C\UF007D\UF007E\UF007F\UF0080\UF0081\UF0082\UF0079'"
;;
esac
if [[ $style == (classic|rainbow) ]]; then if [[ $style == (classic|rainbow) ]]; then
if [[ $style == classic ]]; then if [[ $style == classic ]]; then
@ -2047,7 +2053,7 @@ while true; do
local gap_char=' ' prompt_char='' down_triangle='\uE0BC' up_triangle='\uE0BA' slanted_bar='\u2571' local gap_char=' ' prompt_char='' down_triangle='\uE0BC' up_triangle='\uE0BA' slanted_bar='\u2571'
local left_subsep= right_subsep= left_tail= right_tail= left_head= right_head= time= local left_subsep= right_subsep= left_tail= right_tail= left_head= right_head= time=
local -i num_lines=2 empty_line=0 color=2 left_frame=1 right_frame=1 transient_prompt=0 local -i num_lines=2 empty_line=0 color=2 left_frame=1 right_frame=1 transient_prompt=0
local -i cap_diamond=0 cap_python=0 cap_debian=0 cap_lock=0 cap_quotes=0 local -i cap_diamond=0 cap_python=0 cap_arrow=0 cap_lock=0 cap_quotes=0
local -a extra_icons=('' '' '') local -a extra_icons=('' '' '')
local -a frame_color=(244 242 240 238) local -a frame_color=(244 242 240 238)
local -a color_name=(Lightest Light Dark Darkest) local -a color_name=(Lightest Light Dark Darkest)
@ -2088,12 +2094,17 @@ while true; do
elif (( ! cap_diamond )); then elif (( ! cap_diamond )); then
POWERLEVEL9K_MODE=awesome-fontconfig POWERLEVEL9K_MODE=awesome-fontconfig
else else
ask_debian || continue ask_arrow '\UF0737' || continue
if (( cap_debian )); then if (( cap_arrow )); then
POWERLEVEL9K_MODE=nerdfont-complete POWERLEVEL9K_MODE=nerdfont-v3
else else
POWERLEVEL9K_MODE=awesome-fontconfig ask_arrow '\uFC35' "Let's try another one." || continue
ask_python || continue if (( cap_arrow )); then
POWERLEVEL9K_MODE=nerdfont-complete
else
POWERLEVEL9K_MODE=awesome-fontconfig
ask_python || continue
fi
fi fi
fi fi
fi fi