Skip to content

feat: drop an image on a terminal to upload it - #90

Merged
LukeGus merged 1 commit into
Termix-SSH:dev-1.4.1from
Li-Lee:feat/terminal-image-drop
Nov 17, 2026
Merged

LukeGus merged 1 commit into
Termix-SSH:dev-1.4.1from
Li-Lee:feat/terminal-image-drop

Conversation

@Li-Lee

@Li-Lee Li-Lee commented Nov 17, 2026

Copy link
Copy Markdown

Problem

The docs say "Paste or drop an image into a terminal and Termix uploads it to the host and types its path", but only paste and the toolbar button do that. The terminal has no drop handling:

  • In the macOS desktop app, dragging an image onto a terminal does nothing.
  • In the browser, the image opens in a new tab.

This is handy to have for coding agents in the terminal, where a screenshot is usually a file on the desktop rather than something on the clipboard.

Change

  • Images dropped on the terminal area go through the existing handleImageUpload, the same path as a pasted or picked image. No backend, API or settings changes; the upload is sent with source: "file".
  • Several images dropped together upload one at a time, so their paths are typed in drop order with a space between.
  • A drop that holds files but no image shows the existing "Choose an image file" message, and the browser no longer opens the file.
  • Drags without files (selected text, links) are left alone.
  • While a file drag is over the terminal, a "Drop an image to upload it" overlay shows. New string terminal.imageDropHint in locales/en.json only.

The logic is in a new terminal-image-drop.ts, next to terminal-native-paste.ts. Terminal.tsx spreads the four handlers on the terminal's container. CHANGELOG entry under 1.4.1.

Not included: dropping files onto a waiting rz (the ZMODEM bar keeps its own file picker), and files that are not images.

Testing

  • New terminal-image-drop.test.ts (7 cases): image upload, order with mixed files, a drop with no image, drags without files, and the drag-over state across child elements and after a drop.
  • Full suite 763/763, typecheck, build and Prettier pass.
  • Ran the handlers in Chromium on a small React page that spreads them on a container over a canvas, as the terminal does, with real DragEvents and DataTransfer files: the overlay shows and clears, images arrive in order, a PDF is refused without the browser opening it, and a text drag is untouched.
  • Not yet run inside Termix itself or the desktop app.

🤖 Generated with Claude Code

The docs say "Paste or drop an image into a terminal", but only paste and
the toolbar button worked. A file dropped on a terminal did nothing in the
desktop app, and the browser opened it in a new tab.

Images dropped on the terminal now go through the same upload as a pasted
image and their paths are typed in drop order. A drop with no image shows
the existing "Choose an image file" message. Drags without files are
left alone.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@termix-triage-bot

Copy link
Copy Markdown

AI review | Looks safe to merge

Adds drag-and-drop image upload to the terminal frontend, reusing existing upload logic and adding a visual overlay. No backend or security changes.

Reviewed bbbf5c3. AI can be wrong, a maintainer still decides. Comment /termix review to run it again.

@LukeGus LukeGus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good.

@LukeGus
LukeGus merged commit fd96554 into Termix-SSH:dev-1.4.1 Nov 17, 2026
4 checks passed
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.

2 participants