Skip to content

Paste/drop images into the terminal as files (M1: local)#29

Draft
mvbmir wants to merge 1 commit into
mainfrom
mvbmir/image-paste-m1
Draft

Paste/drop images into the terminal as files (M1: local)#29
mvbmir wants to merge 1 commit into
mainfrom
mvbmir/image-paste-m1

Conversation

@mvbmir

@mvbmir mvbmir commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary

M1 of the cmux-style image drop-to-file feature (#28): paste or drop an image into a terminal and it lands as a real file, with the path injected as text — so it works with TUI agent CLIs (Claude Code, Codex) that can't receive image bytes over a PTY.

What it does

  • Ctrl+V: when the clipboard holds an image, read the texture, write /tmp/limux-drop-<uuid>.png, and paste the shell-escaped path. Falls through to normal text paste when there's no image.
  • Drag-drop: a DropTarget for GdkTexture does the same write-file-and-paste-path.
  • Reuses existing helpers (clipboard_formats_include_image, shell_escape_joined_bytes, the file-drop inject path).

One file, +74 lines, on top of upstream main.

Scope

Local only. The file is written on the box running limux, so the path resolves for agents running locally. SSH parity (write the file on the remote over the existing connection / ControlMaster, like cmux) is the separate M2, tracked in #28 — the foreground-ssh-detection spike there already passed.

Test

  • Copy a screenshot, focus a terminal, Ctrl+V → a /tmp/limux-drop-*.png path is pasted; the file exists and opens.
  • Drag an image from a browser/file manager onto a terminal → same.
  • Ctrl+V of plain text still pastes normally.

Draft: pending local verification of the paste/drop UX.

Part of #28.

Image bytes can't ride a PTY and a TUI agent CLI can't receive them, so
(like cmux's drop-to-file) intercept the image client-side, write it to a
temp PNG, and inject the file path as text. The agent's file-read tool opens
the real file.

- Ctrl+V: when the clipboard holds an image, read the texture, save
  /tmp/limux-drop-<uuid>.png, paste the shell-escaped path; falls through to
  normal text paste otherwise.
- Drag-drop: a DropTarget for GdkTexture mirrors the same write-file-and-paste.

Local only; SSH parity (write on the remote over ControlMaster) tracked in #28.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant