clipboard

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package clipboard provides helpers for resolving pasted images and dropped local image paths from kite clipboard events in the TaskSmith terminal UI.

Index

Constants

View Source
const MaxImageBytes = 20 << 20

MaxImageBytes is the maximum byte size accepted for pasted or dropped images.

Variables

This section is empty.

Functions

func ExtForImageMIME

func ExtForImageMIME(mime string) string

ExtForImageMIME returns the conventional file extension for a supported image MIME type.

Types

type ImageCandidate

type ImageCandidate struct {
	MIMEType    string
	Data        []byte
	DisplayName string
	TooLarge    int64
}

ImageCandidate describes an image resolved from a paste or file drop event.

func ResolvePastedImages

func ResolvePastedImages(items map[string][]byte, text string) []ImageCandidate

ResolvePastedImages extracts image candidates from a clipboard event's MIME items and text payload using strict source precedence:

  1. Dropped local file paths in text (so stale clipboard data cannot hijack drops).
  2. OS file-manager copies in items["text/uri-list"] (ignoring Finder icon thumbnails).
  3. Raw image payloads in items (screenshots, Preview copies, browser images).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL