summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/p10k-lean.zsh2
-rwxr-xr-xinternal/wizard.zsh32
2 files changed, 22 insertions, 12 deletions
diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh
index 77c77ed5..7d9a537d 100644
--- a/config/p10k-lean.zsh
+++ b/config/p10k-lean.zsh
@@ -174,7 +174,7 @@
# OS identifier color.
typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=
# Make the icon bold.
- typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='%B${P9K_CONTENT}'
+ typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT}'
################################[ prompt_char: prompt symbol ]################################
# Green prompt symbol if the last command succeeded.
diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index 2c1d9d41..119b8f62 100755
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -18,7 +18,7 @@ fi
local -ri force
-local -r font_base_url='https://github.com/romkatv/dotfiles-public/raw/master/.local/share/fonts/NerdFonts'
+local -r font_base_url='https://github.com/romkatv/powerlevel10k-media/raw/master'
local -ri wizard_columns=$((COLUMNS < 83 ? COLUMNS : 83))
local -ri prompt_indent=2
@@ -50,7 +50,7 @@ local -r time_24h='16:23:42'
local -r time_12h='04:23:42 PM'
local -ra lean_left=(
- '%$frame_color[$color]F╭─ ' '${extra_icons[1]:+%B%f$extra_icons[1] %b}%31F$extra_icons[2]%B%39F~%b%31F/%B%39Fsrc%b%f $prefixes[1]%76F$extra_icons[3]master%f '
+ '%$frame_color[$color]F╭─ ' '${extra_icons[1]:+%f$extra_icons[1] }%31F$extra_icons[2]%B%39F~%b%31F/%B%39Fsrc%b%f $prefixes[1]%76F$extra_icons[3]master%f '
'%$frame_color[$color]F╰─' '%76F$prompt_char%f ${buffer:-$cursor}'
)
@@ -259,9 +259,9 @@ function iterm_get() {
/usr/libexec/PlistBuddy -c "Print :$1" ~/Library/Preferences/com.googlecode.iterm2.plist
}
-local terminal iterm2_font_size
+local terminal iterm2_font_size iterm2_old_font=0 can_install_font=0
-function can_install_font() {
+() {
[[ $P9K_SSH == 0 ]] || return
if [[ "$(uname)" == Linux && "$(uname -o)" == Android ]]; then
(( $+commands[termux-reload-settings] )) || return
@@ -297,14 +297,15 @@ function can_install_font() {
local guid2 && guid2="$(iterm_get '"New Bookmarks":0:"Guid"' 2>/dev/null)" || return
local font && font="$(iterm_get '"New Bookmarks":0:"Normal Font"' 2>/dev/null)" || return
[[ $guid1 == $guid2 ]] || return
- [[ $font != 'MesloLGSNer-Regular '<-> ]] || return
+ [[ $font != 'MesloLGS-NF-Regular '<-> ]] || return
[[ $font == (#b)*' '(<->) ]] || return
+ [[ $font == 'MesloLGSNer-Regular '<-> ]] && iterm2_old_font=1
iterm2_font_size=$match[1]
terminal=iTerm2
return 0
fi
return 1
-}
+} && can_install_font=1
function run_command() {
local msg=$1
@@ -343,8 +344,10 @@ function install_font() {
zf_mv -f -- ~/Library/Fonts/$file{.tmp,} || quit -c
done
print -nP -- "Changing %BiTerm2%b settings ..."
+ local size=$iterm2_font_size
+ [[ $size == 12 ]] && size=13
local k t v settings=(
- '"Normal Font"' string '"MesloLGSNer-Regular '$iterm2_font_size'"'
+ '"Normal Font"' string '"MesloLGS-NF-Regular '$size'"'
'"Terminal Type"' string '"xterm-256color"'
'"Horizontal Spacing"' real 1
'"Vertical Spacing"' real 1
@@ -356,6 +359,7 @@ function install_font() {
'"Non-ASCII Anti Aliased"' bool 1
'"Use Non-ASCII Font"' bool 0
'"Ambiguous Double Width"' bool 0
+ '"Draw Powerline Glyphs"' bool 1
)
for k t v in $settings; do
/usr/libexec/PlistBuddy -c "Set :\"New Bookmarks\":0:$k $v" \
@@ -363,7 +367,9 @@ function install_font() {
run_command "" /usr/libexec/PlistBuddy -c \
"Add :\"New Bookmarks\":0:$k $t $v" ~/Library/Preferences/com.googlecode.iterm2.plist
done
- run_command "Updating %BiTerm2%b settings cache" /usr/bin/defaults read com.googlecode.iterm2
+ print -P " %2FOK%f"
+ print -nP "Updating %BiTerm2%b settings cache ..."
+ run_command "" /usr/bin/defaults read com.googlecode.iterm2
sleep 3
print -P " %2FOK%f"
clear
@@ -392,12 +398,16 @@ function install_font() {
}
function ask_font() {
- can_install_font || return 0
+ (( can_install_font )) || return 0
{
while true; do
clear
(( greeting_printed )) || print_greeting
- flowing -c "%BInstall %b%2FMeslo Nerd Font%f%B?%b"
+ if (( iterm2_old_font )); then
+ flowing -c A new version of '%2FMeslo Nerd Font%f' is available. "%BInstall?"
+ else
+ flowing -c "%BInstall %b%2FMeslo Nerd Font%f%B?%b"
+ fi
print -P ""
print -P ""
print -P "%B(y) Yes (recommended).%b"
@@ -485,7 +495,7 @@ function ask_diamond() {
print -P ""
print -P "%B(n) No.%b"
print -P ""
- if can_install_font; then
+ if (( can_install_font )); then
extra+=r
print -P "(r) Restart from the beginning."
fi