Skip to content

[Feature] Drag and drop an image into the agent shell buffer #784

Description

@dustinfarris

Checklist

  • I agree to communicate with the author myself (not AI-generated).
  • I've read the README's Filing issues section.
  • I'm running the latest versions (fill in below).
    • agent-shell version: 0.73.3
    • acp.el version: 0.13.1
    • ACP package (e.g. claude-agent-acp) version: claude-agent-acp 0.66.0
    • Agent CLI (e.g. claude, gemini) version: claude 2.1.233
  • For requesting new agent support, I'm including a link to the ACP-capable agent or related ACP package.
  • For issues, I'm including ACP traffic (as per README).

Request

Dragging an image file onto an agent-shell buffer should attach it to the prompt, the way agent-shell-send-clipboard-image and agent-shell-yank-dwim already do for the clipboard.

Current behaviour

agent-shell-mode doesn't handle drops, so a drop falls through to Emacs' default dnd-protocol-alist handling and the image is opened in its own buffer, taking over the window. Nothing reaches the prompt.

Suggested behaviour

On a file:// drop in an agent-shell buffer, insert the file as prompt context — the same thing agent-shell-yank-dwim already does once it has a path:

(agent-shell-insert
 :text (agent-shell--get-files-context :files (list path))
 :shell-buffer (agent-shell--shell-buffer))

A buffer-local dnd-protocol-alist entry set up in agent-shell-mode would cover it.

Two things worth deciding:

  • Non-image files: attaching a dropped .log/.csv/source file as context seems just as useful, but falling back to dnd-open-file for anything non-image is a defensible scope too.
  • Drops that carry image data rather than a file URL (dragging an image straight out of a browser) could reuse the existing save-to-.agent-shell/screenshots path from agent-shell--save-clipboard-image before inserting.

Why

Clipboard paste covers freshly-taken screenshots well. Drag-and-drop covers the other half: images that already exist as files — a design mockup, a diagram, a screenshot sitting in Finder or Dired — where today the route is copying the path out by hand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions