概要
linux-mintでGhosttyを導入したら日本語入力ができませんでした。
また、日本語入力をできたはいいものの次はフォントの変更ができない壁に当たりました。
これらをなんとか解決できたのでまとめます。
日本語入力解決方法
fcitx4をfcitx5にすることで解決できました。
fcitx4をuninstall
sudo apt purge -y fcitx fcitx-mozc
sudo apt autoremove -y
fcitx5をinstall
sudo apt install -y fcitx5 fcitx5-mozc fcitx5-configtool
fcitx5を用いて日本語入力できるようにすることで日本語入力できるようになりました。
フォントの変更
従来、fontの変更は~/.config/ghostty/config に font-familyを設定すれば設定可能なのですが、こちらを設定しても反映されませんでした。
ただ、ghostty +show-config でfont-faimilyを出してみてもちゃんと反映されていました。
ghostty +show-config
font-family = Bizin Gothic NF
font-family-bold = Bizin Gothic NF
font-family-italic = Bizin Gothic NF
font-family-bold-italic = Bizin Gothic NF
完全に謎現象で困ってしまっていたのですが、、以下のコマンドを叩いてghosttyを起動したら原因が見えてきました。
ghostty --font-family Bizin Gothic NF
info: ghostty version=1.2.3
info: ghostty build optimize=ReleaseFast
info: runtime=apprt.Runtime.gtk
info: font_backend=font.main.Backend.fontconfig_freetype
info: dependency harfbuzz=8.3.0
info: dependency fontconfig=21500
info: renderer=renderer.generic.Renderer(renderer.OpenGL)
info: libxev default backend=io_uring
info(os_locale): setlocale from env result=ja_JP.UTF-8
info(gtk): GTK version build=4.14.5 runtime=4.14.5
info(gtk): libadwaita version build=1.5.0 runtime=1.5.0
info: reading configuration file path=/home/user/.config/ghostty/config
info(config): default shell source=env value=/home/linuxbrew/.linuxbrew/bin/fish
warning(gtk_ghostty_application): setting GDK_DEBUG=gl-disable-gles,gl-no-fractional,vulkan-disable
warning(gtk_ghostty_application): setting GDK_DISABLE=color-mgmt
info(gtk_ghostty_application): cgroup isolation disabled via config=config.Config.LinuxCgroup.single-instance
warning(gtk_ghostty_global_shortcuts): request failed=GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.GlobalShortcuts” on object at path /org/freedesktop/portal/desktop (19)
info(opengl): loaded OpenGL 4.6
info(font_shared_grid_set): font regular: Takaoゴシック
info(font_shared_grid_set): font regular: Takaoゴシック
info(font_shared_grid_set): font bold: Takaoゴシック
info(font_shared_grid_set): font bold: Takaoゴシック
info(font_shared_grid_set): font italic: Takaoゴシック
info(font_shared_grid_set): font italic: Takaoゴシック
info(font_shared_grid_set): font bold_italic: Takaoゴシック
info(font_shared_grid_set): font bold_italic: Takaoゴシック
info(io_exec): found Ghostty resources dir: /usr/share/ghostty
info(io_exec): shell integration automatically injected shell=termio.shell_integration.Shell.fish
warning(gtk_ghostty_application): unimplemented action=apprt.action.Action.Key.cell_size
info(io_exec): started subcommand path=/bin/sh pid=12411
info(io_exec): subcommand cgroup=-
warning(stream): unimplemented OSC callback: terminal.osc.Command{ .end_of_command = terminal.osc.Command__struct_253470{ .exit_code = null } }
warning(stream): unimplemented OSC command: end_of_command
info(osc): unknown semantic prompts option: click_events
info(osc): unknown semantic prompts option: cmdline_url
warning(stream): unimplemented OSC callback: terminal.osc.Command{ .end_of_command = terminal.osc.Command__struct_253470{ .exit_code = 0 } }
warning(stream): unimplemented OSC command: end_of_command
warning(stream): unimplemented OSC callback: terminal.osc.Command{ .end_of_command = terminal.osc.Command__struct_253470{ .exit_code = 0 } }
warning(stream): unimplemented OSC command: end_of_command
info(io_exec): pty fd closed, read thread exiting
info(surface): surface closed addr=653cb84bb7d0
なぜか指定したフォントが使われずにTakaoゴシックにfallbackしているようでした。
このログで検索をかけると以下のdiscussionsが上がっていました。
https://github.com/ghostty-org/ghostty/discussions/9667
どうやら、localeの設定をJPにしていることが問題になっているらしい。
ためしに、以下の様にして起動してみると正しく起動してくれました。
LANG=en_US.UTF-8 ghostty
これを解決するにはghosttyの起動コマンド時上記環境変数を渡してあげることで解決できそうですが
LANGをJPにすることで困ることがこれからもちょくちょく出てくるだろうということで、思い切って言語をUSに変えてしまうことで解決できました
終わりに
よりよい解決策があれば教えてください。