Open Claude Code inside a split pane in Wezterm
I wrote about how I use Claude Code in Wezterm in this Post.
Since then, I've improved it a bit. I introduced the yolo mode --dangerously-skip-permissions as default when I open CC and I need to split the window pane on my desktop monitor to 1/3 and on my laptop monitor to ½.
The split introduced a new function, which is called on keypress.
local function split_for_claude()
local screen = wezterm.gui and wezterm.gui.screens().active.name or ""
local percent = 50
if screen == EXTERNAL_MONITOR then
percent = 33
end
return act.SplitPane({
direction = "Right",
command = { args = { "bash", "-lc", "claude --dangerously-skip-permissions" } },
size = { Percent = percent },
})
end
EXTERNAL_MONITOR is the name of the external monitor. The name you will get from opening the Debug Overlay and calling wezterm.gui.screens().
And the key settings are:
config.keys = {
-- ...
{
key = "Enter",
mods = "LEADER",
action = wezterm.action_callback(function(window, pane)
window:perform_action(split_for_claude(), pane)
end),
},
-- ...
}
Now I hit leader+enter and CC opens in a 1/3 or ½ split depending on the display. :)
57 of #100DaysToOffload
#log #wezterm #code #dev
_Thoughts? Discuss...