fix font prompt

This commit is contained in:
2026-04-03 15:24:09 +09:00
parent 24b072c539
commit 37177b0091
3 changed files with 19 additions and 10 deletions

View File

@@ -23,7 +23,7 @@ get_cfg() {
} }
has_aifont() { has_aifont() {
[ -f "$HOME/Library/Fonts/aifont.ttf" ] || [ -f "$HOME/.local/share/fonts/aifont.ttf" ] [ -f "$HOME/Library/Fonts/aifont.ttf" ] || [ -f "/usr/share/fonts/TTF/aifont.ttf" ]
} }
can_run() { can_run() {

View File

@@ -2,7 +2,7 @@
# requires: aifont (MesloLGS NF + ai/syui icons) # requires: aifont (MesloLGS NF + ai/syui icons)
_has_aifont() { _has_aifont() {
[[ -f "$HOME/Library/Fonts/aifont.ttf" ]] || [[ -f "$HOME/.local/share/fonts/aifont.ttf" ]] [[ -f "$HOME/Library/Fonts/aifont.ttf" ]] || [[ -f "/usr/share/fonts/TTF/aifont.ttf" ]]
} }
_powerline_git() { _powerline_git() {

View File

@@ -66,15 +66,24 @@ if [ ! -f "$HOME/.vim/autoload/plug.vim" ]; then
fi fi
# install font # install font
fontpath="$HOME/.local/share/fonts/aifont.ttf" fonturl="https://git.syui.ai/ai/font/raw/branch/main/aifont.ttf"
case "$(uname)" in
Darwin)
fontpath="$HOME/Library/Fonts/aifont.ttf"
;;
*)
fontpath="/usr/share/fonts/TTF/aifont.ttf"
;;
esac
if [ ! -f "$fontpath" ]; then if [ ! -f "$fontpath" ]; then
mkdir -p "$HOME/.local/share/fonts" mkdir -p "$(dirname "$fontpath")"
curl -sL -o "$fontpath" https://git.syui.ai/ai/font/raw/branch/main/aifont.ttf if [ "$(uname)" = "Darwin" ]; then
echo "font: downloaded aifont.ttf" curl -sL -o "$fontpath" "$fonturl"
else
sudo curl -sL -o "$fontpath" "$fonturl"
fc-cache -f 2>/dev/null
fi fi
if [ "$(uname)" = "Darwin" ] && [ -f "$fontpath" ]; then echo "font: $fontpath"
cp -f "$fontpath" ~/Library/Fonts/aifont.ttf
echo "font: aifont.ttf -> ~/Library/Fonts/"
fi fi
echo "done" echo "done"