Ghosttyはクロスプラットフォームのターミナルエミュレーター。動作が軽くカスタマイズ性が高い。

Macへのインストールと設定

brewでインストールした。

brew install --cask ghostty

各種の設定はGUIではなくconfigファイルで行う。 ~/Library/Application Support/com.mitchellh.ghostty/config

設定ファイルをターミナル内から再読み込みするのはcmd+shift+,

ターミナルから以下のコマンドを入力すると、使用できる(インストールされている)フォントファミリのリストが表示される。

ghostty +list-fonts

以下のコマンドでインストールされているテーマのリストが表示される。

ghostty +list-themes

このようにプレビューを表示しながらテーマを選ぶことができる。

現時点での設定ファイルは以下の通り。

theme = "Dracula"
 
font-family = "UDEV Gothic"
font-thicken
font-size = 20
 
mouse-hide-while-typing
 
window-theme = dark
background-opacity = 0.8
background-blur = true
macos-titlebar-style = transparent
 
window-inherit-working-directory = true
window-save-state = always

設定可能な項目の説明はConfigurationにある。かなりの数があるが、自分は必要最低限のものに絞った。

Alfred関連の設定

デフォルトで使用するターミナルをGhosttyに変更するため、Alfredの設定変更とワークフローの修正を行った。

Teminalの設定変更

以下のGhosttyとの連携スクリプトを手順に従って設定する。

zeitlings/alfred-ghostty-script: AppleScript for Ghostty Alfred integration

terminalfinderワークフローの修正

ファインダとターミナルを行き来するのに使っているAlfredのtermmialfinderワークフローにGhostty用のトリガーとスクリプトを追加した。

LeEnno/alfred-terminalfinder: Alfred workflow to open current Finder window in Terminal/iTerm and vice versa.

Finderで表示しているフォルダをGhosttyで開くスクリプト(キーワードfgでトリガー)

tell application "Finder"
	set pathList to (quoted form of POSIX path of (folder of the front window as alias))
end tell
 
do shell script "open -a Ghostty.app " & pathList

GhosttyのカレントディレクトリをFinderで開くスクリプト(キーワードgfでトリガー)

on alfred_script(q)
  tell application "Ghostty" to activate
  delay 0.2
 
  set cmd to "open -a Finder ./"
  do shell script "printf %s " & quoted form of cmd & " | pbcopy"
 
  tell application "System Events"
    tell process "Ghostty"
      keystroke "v" using command down
      keystroke return
    end tell
  end tell
end alfred_script