Build stuff; Break stuff; Have fun!

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...

There is a post about how I migrated to WEZterm, which I still need to write at some time in the future.

Preliminary skirmish

But let’s assume I already wrote the post. I’m really happy with the terminal. I needed to migrate away from Alacritty+Tmux because of the lack of Windows support from Tmux. Overall it was a good decision to migrate. The only thing that currently bothers me is that there is a “bug” where the font rendering misses some characters but brings them back on config reload. (cmd+r)

Here starts the main post

After starting my journey with Claude Code, I needed a handy shortcut to open CC in a 1/3 split pane. Here is the part of my config, which is doing the Job:

config.keys = {
        --...
	{
		key = "c",
		mods = "LEADER|SHIFT",
		action = act.SplitPane({
			direction = "Right",
			command = { args = { "bash", "-lc", "claude" } },
			size = { Percent = 33 },
		}),
	},
	--...
}

You'll hit leader & shift+c and it will open a 1/3 sidebar with Claude Code in it. Done.

For me it is a nice little helper. Hopefully for someone else too. Let me know if this was helpful.


37 of #100DaysToOffload
#log #dev #claude #wezterm
Thoughts? Discuss...