libghostty
Loading...
Searching...
No Matches
GhosttyClipboardRead Struct Reference

#include <ghostty/vt/terminal.h>

Data Fields

size_t size
GhosttyClipboardLocation location
const GhosttyStringmimes
size_t mimes_len
bool list
GhosttyString name
bool granted
bool can_remember
const void * ctx
GhosttyClipboardReadReplyFn reply

Detailed Description

A synchronous request to read clipboard contents.

This is a sized struct. The callback must only access fields present in the size reported by size. The request is borrowed and valid only for the callback duration.

The read is answered by calling reply with this request and a GhosttyClipboardReadReply. This must happen before the callback returns; the request is invalid afterwards. Calling reply more than once is ignored. Returning without replying answers the program with an empty clipboard (OSC 52) or EPERM (OSC 5522).

Examples
c-vt-paste/src/main.c.

Definition at line 727 of file terminal.h.

Field Documentation

◆ can_remember

bool can_remember

True if the program supplied a session password, so the embedder may offer to remember the user's decision through GhosttyClipboardReadReply::remember. When false, remember is ignored.

Definition at line 773 of file terminal.h.

◆ ctx

const void* ctx

Terminal-owned reply state. Do not access.

Definition at line 776 of file terminal.h.

◆ granted

bool granted

True if the terminal already holds a session grant for this request (kitty clipboard protocol passwords). The embedder should skip any permission prompt and serve the read.

Always false when mimes_len is zero: such a request is served without a prompt (see the callback docs), so the terminal never consults grants for it and a one-time password is preserved for the follow-up data read.

Examples
c-vt-paste/src/main.c.

Definition at line 766 of file terminal.h.

◆ list

bool list

True if the program also wants the list of MIME types available on the clipboard, delivered through GhosttyClipboardReadReply::available.

Definition at line 748 of file terminal.h.

◆ location

Clipboard to read.

Definition at line 732 of file terminal.h.

◆ mimes

const GhosttyString* mimes

Borrowed array of the MIME types the program wants, in order of preference. Protocols that only carry text (OSC 52) request "text/plain". NULL when mimes_len is zero.

Definition at line 739 of file terminal.h.

◆ mimes_len

size_t mimes_len

Number of entries in mimes.

Definition at line 742 of file terminal.h.

◆ name

Name of the requesting program for permission prompts, if the protocol carries one. Empty otherwise.

Examples
c-vt-paste/src/main.c.

Definition at line 754 of file terminal.h.

◆ reply

Answer the read; see the struct documentation.

Examples
c-vt-paste/src/main.c.

Definition at line 779 of file terminal.h.

◆ size

size_t size

Size of this struct in bytes.

Definition at line 729 of file terminal.h.


The documentation for this struct was generated from the following file: