Terminal Alacritty の設定方法について調査した結果を備忘録として残しておく

環境

  • OS: macOS 14.7

手順

Alacritty のセットアップ

  1. フォントのインストール

    brew install --cask font-monaspace
    
    # Hack Nerd Font
    brew install font-hack-nerd-font
    
    # HackGen
    brew install font-hackgen
    
    # HackGen Nerd
    brew install font-hackgen-nerd
    
  2. 以下のコマンドを実行する

    brew install --cask alacritty
    mkdir -p ~/.config/alacritty
    vim ~/.config/alacritty/alacritty.toml
    
  3. config ファイルを修正する

    設定値については参考を参照

    import = [
      "~/.config/alacritty/themes/themes/pastel_dark.toml" # theme
    ]
    
    [env]
    TERM = "xterm-256color"
    
    [window]
    padding.x = 10
    padding.y = 10
    decorations = "Full"
    opacity = 0.9 # 透過率
    blur = false
    option_as_alt = "Both"
    
    [font]
    normal.family = "HackGen35 Console NF" # Font Family を指定
    normal.style = "Bold"
    size = 16
    
  4. alaciritty-themes のセットアップ

    ~/.config/alacritty/alacritty.toml の import にて指定する
    theme の詳細は公式を参照

    cd ~/.config/alacritty
    git clone https://github.com/alacritty/alacritty-theme themes
    
  5. zsh-autosuggestions, zsh-syntax-highlighting のセットアップ

    brew install zsh-autosuggestions
    echo "source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc
    
    brew install zsh-syntax-highlighting
    echo "source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
    
    source ~/.zshrc
    
  6. zellij or tmux のセットアップ

    zellij

    brew install zellij
    mkdir ~/.config/zellij
    zellij setup --dump-config > ~/.config/zellij/config.kdl
    

    tmux

    brew install tmux
    touch ~/.config/tmux/.tmux.conf
    

    .tmux.conf の設定内容は dotfiles 参照

  7. zellij or tmuxの起動

    zellij
    

    ターミナル起動時に zellij を自動起動させる場合は config ファイルに以下を追記する
    ※以下は、homebrew で zellij をインストールした場合 path を which tmux で確認すること!

    [shell]
    program = "/bin/zsh"
    args = [
      "-l",
      "-c",
      "/opt/homebrew/bin/zellij attach --index 0 --create",
    ]
    

    ターミナル起動時に tmux を自動起動させる場合は config ファイルに以下を追記する
    ※以下は、homebrew で tmux をインストールした場合 path を which tmux で確認すること!

    [shell]
    program = "/bin/zsh"
    args = [
      "-l",
      "-c",
      "/opt/homebrew/bin/tmux a -t 0 || /opt/homebrew/bin/tmux -u",
    ]
    

Alacritty のアイコンの変更

issueで議論されている件

置換前 Alacritty アイコン
置換前 Alacritty アイコン
置換後 Alacritty アイコン
置換後 Alacritty アイコン
  1. 以下のコマンドを実行

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/hmarr/dotfiles/refs/heads/main/bin/update-alacritty-icon.sh)"