WSL2 Ubuntu 24.04 + bash + chezmoi 前提で、WezTerm から Claude Code と Codex の進捗をタブ単位で見分けるための設定です。停止や入力待ちで BEL が鳴ると、そのタブだけ ● claude:repo / ● codex:repo の表示に変わります。
~/.config/wezterm/wezterm.lua~/.config/wezterm/keys.lua~/.config/wezterm/ui.lua~/.config/wezterm/commands.lua~/.config/wezterm/domains.lua~/.config/bash/wezterm-agents.sh~/.local/bin/agent-bell.sh~/.claude/settings.json~/.codex/config.toml
- Windows 側
- WezTerm
winget
- WSL2 Ubuntu 24.04 側
bash- Homebrew
chezmoilua5.4
補足:
- WezTerm の設定ファイルは Lua ですが、通常運用では
luaコマンド自体は不要です。 - この repo ではローカル構文確認や将来の検証用に
lua5.4も bootstrap 対象に入れています。
WSL 側は bootstrap-wsl.sh を使います。
cd ~/VSCode/dotfiles
chmod +x scripts/bootstrap-wsl.sh
./scripts/bootstrap-wsl.shこのスクリプトは以下を行います。
- Ubuntu パッケージ
build-essential,procps,curl,file,git,lua5.4を入れる - Homebrew を未導入ならインストールする
brew install chezmoiを実行するchezmoi -S "$HOME/VSCode/dotfiles" applyを実行する
repo の場所が違う場合は REPO_DIR を渡します。
REPO_DIR=$HOME/src/dotfiles ./scripts/bootstrap-wsl.sh注意:
apt-get updateは既存の third-party PPA に依存します。ubuntugisのようにnoble非対応の source が残っていると bootstrap は失敗します。- その場合は対象の
.list/.sourcesをユーザー側で無効化してから再実行してください。
Windows 側セットアップは WSL の bash からそのまま起動できます。
powershell.exe -ExecutionPolicy Bypass \
-File "$(wslpath -w "$PWD/scripts/install-wezterm.ps1")" \
-LinuxUser <your-linux-user>このスクリプトは以下を行います。
winget install --id wez.wezterm --exact --source winget%USERPROFILE%\.wezterm.luaに WSL 側設定を読む shim を作成
WSL ディストリ名が違う場合は -Distro を渡します。
powershell.exe -ExecutionPolicy Bypass \
-File "$(wslpath -w "$PWD/scripts/install-wezterm.ps1")" \
-Distro Ubuntu \
-LinuxUser <your-linux-user>Windows 版 WezTerm は通常 %USERPROFILE%\.wezterm.lua を読みます。WSL 側で管理している本体設定を読む薄い shim を Windows 側に置いてください。
local config_dir = [[\\\\wsl$\\Ubuntu\\home\\<your-linux-user>\\.config\\wezterm\\]]
package.path = table.concat({
config_dir .. "?.lua",
config_dir .. "?/init.lua",
package.path,
}, ";")
local wsl_config = [[\\\\wsl$\\Ubuntu\\home\\<your-linux-user>\\.config\\wezterm\\wezterm.lua]]
return dofile(wsl_config)WSL ディストリ名が Ubuntu 以外なら、UNC パスと domains.lua の preferred を合わせて変更してください。
生成される shim は先に package.path を補正するため、UNC 越しでも keys.lua, ui.lua, domains.lua を読み込めます。
新規タブは WezTerm 内の bash から開きます。
wcc repo ~/work/repo
wcx repo ~/work/repowcc <name> <dir>はclaude:<name>タイトルの bash タブを開きます。wcx <name> <dir>はcodex:<name>タイトルの bash タブを開きます。- どちらも指定ディレクトリで
bash -lを開くだけなので、claude/codex自体はそのタブで手動起動します。 - 現在タブの表示名を変えたいときは
wta <title>を使います。
- 通常表示は
claude:repo/codex:repoです。 - Claude Code の
NotificationとStophook、Codex のnotifyが~/.local/bin/agent-bell.shを呼びます。 agent-bell.shはprintf '\a'を送るだけなので、WezTerm のbellevent が対象タブを要確認として記録します。- 非アクティブの要確認タブは
● claude:repo/● codex:repoで表示されます。
- 要確認状態は、そのタブを選択すると自動で消えます。
- タイトルそのものは保持されるので、確認後は
claude:repo/codex:repoに戻ります。 wtaは名前変更用です。要確認フラグの解除操作としては不要です。
~/.claude/settings.json は Notification と Stop の両方で agent-bell.sh を async 実行するテンプレートです。project 単位ではなくユーザー設定として配る前提です。
~/.codex/config.toml は現行の notify = [...] を使います。Codex 側の停止通知は hooks 前提ではなく、完了時に agent-bell.sh を呼ぶ実運用テンプレートです。
- WSL で
./scripts/bootstrap-wsl.shを実行し、Homebrew / chezmoi / lua5.4 と dotfiles を適用する。 - WSL で
powershell.exe -ExecutionPolicy Bypass -File "$(wslpath -w "$PWD/scripts/install-wezterm.ps1")" -LinuxUser <your-linux-user>を実行して WezTerm と shim を入れる。 - WezTerm を再起動し、WSL bash タブを開く。
wcc repo ~/work/repoまたはwcx repo ~/work/repoで agent 用タブを作り、そのタブでclaude/codexを起動する。- 停止や入力待ちで
● claude:repo/● codex:repoを確認し、タブを選んで解除する。
- Homebrew install: https://brew.sh/
- Homebrew on Linux / WSL: https://docs.brew.sh/Homebrew-on-Linux
- chezmoi install: https://www.chezmoi.io/install/
- WezTerm
format-tab-title: https://wezterm.org/config/lua/window-events/format-tab-title.html - WezTerm
bell: https://wezterm.org/config/lua/window-events/bell.html - WezTerm
update-status: https://wezterm.org/config/lua/window-events/update-status.html - WezTerm
cli spawn: https://wezterm.org/cli/cli/spawn.html - WezTerm
cli set-tab-title: https://wezterm.org/cli/cli/set-tab-title.html - Claude Code hooks: https://code.claude.com/docs/en/hooks
- Codex config / notify: https://github.com/openai/codex/blob/main/docs/config.md