Skip to content

macOS: performable paste_from_clipboard (parity with GTK #10089)Β #10751

@mitchellh

Description

@mitchellh

Discussed in #10620

Originally posted by juniqlim February 8, 2026
PR #10089 added performable paste support for GTK β€” when the clipboard has no text (e.g. only an image), paste_from_clipboard returns false so the key passes through to the application.

macOS doesn't have this yet. The embedded apprt's clipboardRequest() always returns true, so the keybind is always consumed even when there's nothing to paste.

This matters for TUI apps like Claude Code that handle image paste natively β€” they need to receive the keypress when the clipboard contains only image data.

The GTK implementation checks clipboard content types synchronously before starting the async read. As mitchellh noted in #10089, macOS clipboards are also async but the empty/type check can be done synchronously via NSPasteboard.

Would it be acceptable to implement the same pattern for the embedded apprt? The approach would be:

  1. Add a clipboard_has_text callback to the embedded runtime options
  2. Check it in clipboardRequest() for paste requests, return false when no text
  3. Make default paste bindings performable (matching what config: make default copy_to_clipboard binds performableΒ #8504 did for copy)

I have a working local build with this approach and confirmed it works with Claude Code on macOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions