Clipboard types other than text on Windows #29

Closed
opened 2026-10-16 15:11:37 -05:00 by jeff · 2 comments
Owner

On Windows, harrier's clipboard is text only: CF_UNICODETEXT in both directions. #23 brings any Clipboard type to Wayland, and leaves Windows for here.

Windows has clipboard formats, not MIME types, so this needs a mapping in both directions. Decisions to make:

  • Which formats map to which types: PNG (registered) ↔ image/png; HTML Format, which wraps the HTML in its own header with byte offsets, ↔ text/html; CF_DIB/CF_DIBV5 ↔ an image. Most screenshot tools put only a DIB on the clipboard, so whether harrier converts DIB to PNG decides whether reading an image works at all.
  • Whether an unmapped MIME type is written as a registered format named after it, so harrier ↔ harrier and other MIME-aware programs round-trip.
  • What the listing reports for formats with no MIME name.

The drag and drop code's IDataObject helpers (hasFormat, dataOf, formatOf) are a starting point.

On Windows, harrier's clipboard is text only: `CF_UNICODETEXT` in both directions. #23 brings any Clipboard type to Wayland, and leaves Windows for here. Windows has clipboard formats, not MIME types, so this needs a mapping in both directions. Decisions to make: - Which formats map to which types: `PNG` (registered) ↔ `image/png`; `HTML Format`, which wraps the HTML in its own header with byte offsets, ↔ `text/html`; `CF_DIB`/`CF_DIBV5` ↔ an image. Most screenshot tools put only a DIB on the clipboard, so whether harrier converts DIB to PNG decides whether reading an image works at all. - Whether an unmapped MIME type is written as a registered format named after it, so harrier ↔ harrier and other MIME-aware programs round-trip. - What the listing reports for formats with no MIME name. The drag and drop code's `IDataObject` helpers (`hasFormat`, `dataOf`, `formatOf`) are a starting point.
Author
Owner

Implemented in b88d6fd; left open until it's been tried on Windows: copying an image and HTML both into and out of harrier, and pasting a screenshot (a bare DIB) into a kitty-protocol program.

Implemented in b88d6fd; left open until it's been tried on Windows: copying an image and HTML both into and out of harrier, and pasting a screenshot (a bare DIB) into a kitty-protocol program.
Author
Owner

Tried on Windows: a PNG put on the clipboard pastes. Carried by b88d6fd.

Tried on Windows: a PNG put on the clipboard pastes. Carried by b88d6fd.
jeff closed this issue 2026-10-16 23:38:58 -05:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jeff/harrier#29
No description provided.