← BACK TO KUBUNTU ENV
Terminal Setup

Ghostty & Zellij 構築

Kubuntu環境の高速なターミナルとして Ghostty を導入し、マルチプレクサの Zellij と組み合わせて使っている。見返すための備忘録。

パッケージのインストール

まずは必要なパッケージやツールをインストールする。

# Rustのインストール(ZellijやYaziなどRust製ツールのビルドに必要)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"

# ターミナルマルチプレクサ Zellij のインストール
cargo install zellij

# ファイルツリー (yazi) とその他の必須パッケージ
cargo install yazi-fm yazi-cli

※ Ghostty は現在ソースビルド環境のため、公式の手順(Zigやパッケージマネージャー経由)に従ってインストールする。

Ghostty 設定 (.config/ghostty/config)

# --- 見た目・フォント ---
font-size = 14
adjust-cell-height = 10%
# ツリー表示ツール(filetreeやyazi)のアイコンを表示するためNerd Fontを明示
font-family = "Hack Nerd Font"
theme = Moonfly

# --- ウィンドウ・透明度 ---
background-opacity = 0.90
background-blur-radius = 20
window-padding-x = 10
window-padding-y = 10
window-padding-balance = true

# --- 操作性 ---
mouse-hide-while-typing = true
copy-on-select = true
clipboard-read = allow
clipboard-write = allow

# --- キーバインド設定(Kubuntu向け画面分割スペシャル) ---
# Ctrl+Shift+D で「右に」分割(VSCodeや標準的なLinuxターミナルで馴染みのある配置)
keybind = ctrl+shift+d=new_split:right

# Ctrl+Shift+Enter で「下に」分割
keybind = ctrl+shift+enter=new_split:down

# Alt + 矢印キー で分割した画面を「移動」
keybind = alt+left=goto_split:left
keybind = alt+right=goto_split:right
keybind = alt+up=goto_split:top
keybind = alt+down=goto_split:bottom

# Ctrl + Shift + 矢印キー で分割サイズを「調整」
keybind = ctrl+shift+left=resize_split:left,20
keybind = ctrl+shift+right=resize_split:right,20
keybind = ctrl+shift+up=resize_split:up,20
keybind = ctrl+shift+down=resize_split:down,20

# Ctrl+Shift+W で現在の「ペイン(分割)」を閉じる
keybind = ctrl+shift+w=close_surface

VSCodeライクな画面分割キーバインドを取り入れつつ、適度な透明度やブラーを効かせて視認性とモダンな見た目を両立させている。

Zellij レイアウトと起動

# レイアウトディレクトリの作成
mkdir -p ~/.config/zellij/layouts

# カスタムレイアウトの設定
vim ~/.config/zellij/layouts/ide.kdl

ide.kdl の内容(3カラム・VSCode風構成案)

左側にエクスプローラーとGit、中央にエディタとターミナルパネル、右側にAIアシスタント(Gemini)を配置した、VSCodeに近い高機能な3カラム構成。

layout {
    default_tab_template {
        pane size=1 borderless=true {
            plugin location="zellij:tab-bar"
        }
        children
        pane size=2 borderless=true {
            plugin location="zellij:status-bar"
        }
    }

    tab name="VSCode Environment" split_direction="vertical" {
        // 左側のサイドバー領域(幅20%)
        pane size="20%" split_direction="horizontal" {
            // 上部:ファイルエクスプローラー (VSCodeのエクスプローラーパネル)
            pane name="Explorer" command="yazi" size="60%"
            // 下部:Gitクライアント (VSCodeのソース管理パネル)
            pane name="Git" command="gitui" size="40%"
        }

        // 中央のメイン領域(幅60%)
        pane size="60%" split_direction="horizontal" {
            // 上部:エディタ領域 (VSCodeのメインエディタ)
            pane name="Editor" focus=true size="75%" {
                // ここでHelixやNvimを使用
            }

            // 下部:ターミナル・モニタ領域 (VSCodeの下部パネル)
            pane name="Panel" split_direction="vertical" size="25%" {
                // 左側:汎用ターミナル(ビルドやコマンド実行用)
                pane name="Terminal"
                // 右側:リソースモニター(バックグラウンド処理の監視用)
                pane name="Monitor" command="btm"
            }
        }

        // 右側のGemini領域(幅20%)
        pane name="Gemini" size="20%" command="gemini"
    }
}

起動コマンド

zellij --layout ide

作成した独自のIDEレイアウト(ide.kdl)を指定して起動し、即座に作業環境を立ち上げられるようにしている。