diff --git a/.tmux/plugin/ailog.zsh b/.tmux/plugin/ailog.zsh index 773f61a..4352613 100755 --- a/.tmux/plugin/ailog.zsh +++ b/.tmux/plugin/ailog.zsh @@ -23,7 +23,7 @@ get_cfg() { } 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() { diff --git a/.zsh/plugin/powerline.zsh b/.zsh/plugin/powerline.zsh index 63f2adf..c860c7d 100644 --- a/.zsh/plugin/powerline.zsh +++ b/.zsh/plugin/powerline.zsh @@ -2,7 +2,7 @@ # requires: aifont (MesloLGS NF + ai/syui icons) _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() { diff --git a/install.zsh b/install.zsh index 85b4175..446cd51 100755 --- a/install.zsh +++ b/install.zsh @@ -66,15 +66,24 @@ if [ ! -f "$HOME/.vim/autoload/plug.vim" ]; then fi # 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 - mkdir -p "$HOME/.local/share/fonts" - curl -sL -o "$fontpath" https://git.syui.ai/ai/font/raw/branch/main/aifont.ttf - echo "font: downloaded aifont.ttf" -fi -if [ "$(uname)" = "Darwin" ] && [ -f "$fontpath" ]; then - cp -f "$fontpath" ~/Library/Fonts/aifont.ttf - echo "font: aifont.ttf -> ~/Library/Fonts/" + mkdir -p "$(dirname "$fontpath")" + if [ "$(uname)" = "Darwin" ]; then + curl -sL -o "$fontpath" "$fonturl" + else + sudo curl -sL -o "$fontpath" "$fonturl" + fc-cache -f 2>/dev/null + fi + echo "font: $fontpath" fi echo "done"