Skip to content

HyprlandでGhosttyのQuick Terminalを使う方法

GhosttyのQuick Terminalという機能は、何か作業中の場合に一時的なコマンド実行をしたい場合に使うためのもので、設定次第だが特定のショートカットキーを押せば画面の上部から小さいターミナルのウィンドウが出現する。

具体的な設定方法は次の通り。

keybind = "global:ctrl+backquote=toggle_quick_terminal"

Keybinding Action Reference / toggle_quick_terminalのドキュメントによると、

On Linux, the quick terminal is only supported on Wayland and not X11, and only on Wayland compositors that support the wlr-layer-shell-v1 protocol. In practice, this means that only GNOME users would not be able to use this feature.

とあるので wlr-layer-shell-v1 プロトコルが実装されたコンポジタであれば動くらしいが、少なくとも

  • Ghostty 1.3.1
  • Hyprland 0.55.1

の組み合わせでは、フォーカスがGhosttyにあれば意図した動作をするが、別のウインドウにフォーカスがある場合ではショートカットキーが反応しなかった。

なので次点の対策として、Hyprland側でイベントのルーティングを行う必要がある。具体的には次の設定が必要。

hl.bind("CTRL + grave", hl.dsp.pass({ window = "class:com.mitchellh.ghostty" }))

こうしておくと、まずキー入力をHyprlandがハンドルして、設定に従いGhosttyへ転送する。