# Pasting Images into Claude Code in Wezterm
Since starting to use Claude Code a month or two age, pasting images has never worked. There are a few related GitHub issues, but nothing that helpful.
I stumbled on this useful quick fix on blog.shukebeta.com, but it’s geared for Kitty terminal. Here’s a useful conversion for Wezterm that basically replaces the Kitty stuff with simple output to stdout. The script itself may work on other terminals as there’s nothing Wezterm specific here, but you’ll need to setup a keyboard shortcut yourself.
In ~/.local/bin/clip2path:
1#!/usr/bin/env bash
2set -e
3
4if [ -n "$WAYLAND_DISPLAY" ]; then
5 types=$(wl-paste --list-types)
6 if grep -q '^image/' <<<"$types"; then
7 ext=$(grep -m1 '^image/' <<<"$types" | cut -d/ -f2 | cut -d';' -f1)
8 file="/tmp/clip_$(date +%s).${ext}"
9 wl-paste > "$file"
10 echo -n "$file"
11 else
12 wl-paste --no-newline
13 fi
14elif [ -n "$DISPLAY" ]; then
15 types=$(xclip -selection clipboard -t TARGETS -o)
16 if grep -q '^image/' <<<"$types"; then
17 ext=$(grep -m1 '^image/' <<<"$types" | cut -d/ -f2 | cut -d';' -f1)
18 file="/tmp/clip_$(date +%s).${ext}"
19 xclip -selection clipboard -t "image/${ext}" -o > "$file"
20 echo -n "$file"
21 else
22 xclip -selection clipboard -o
23 fi
24fi
Make it executable:
1chmod +x ~/.local/bin/clip2path
Then update your Wezterm config (mine’s at ~/.config/wezterm/wezterm.lua) so your keys section looks like this:
1 -- other config ...
2 keys = {
3 {
4 key = 'v',
5 mods = 'CTRL|ALT',
6 action = wezterm.action_callback(function(window, pane)
7 local success, stdout, stderr = wezterm.run_child_process({
8 os.getenv('HOME') .. '/.local/bin/clip2path'
9 })
10 if success and stdout then
11 -- Remove any trailing newlines
12 local text = stdout:gsub("[\r\n]+$", "")
13 -- Send the text to the pane
14 pane:send_text(text)
15 end
16 end) ,
17 },
18 },
19 -- ... other config
After closing/reopening Wezterm, image paste should be available in Claude Code using Ctrl + Alt + v.
Note
This does create images in \tmp, which may be undesirable if you share the machine with others, but I don’t intend on running this for anything that’s going to expose anything (I’m 96% confident, anyway).