LavaUI docs

enum ClipboardBridge

Swift

enum ClipboardBridge

Indirection so LavaUI views can reach the clipboard without every view carrying an Editor reference. The app installs this once at startup.

Sources/LavaUI/TextField.swift:923

Properties

static var canWriteImage: Bool { get }

Whether a picture can be copied at all here — worth asking before offering the user a Copy button that would do nothing.

Sources/LavaUI/TextField.swift:955

nonisolated(unsafe) static var imageFileWriter: ((String) -> Void)?

Offers the PNG at a path as the selection. Nil if the host cannot hold a picture, which is every windowed build: GLFW's clipboard is text and nothing else, and a copy that silently did nothing would be discovered in another application some minutes later.

A path, like ScreenCapture, and for the same reason: a picture does not fit in a shared-memory message. The host reads the file before it answers, so the caller may delete it immediately.

Sources/LavaUI/TextField.swift:937

nonisolated(unsafe) static var imageReader: (() -> [UInt8])?

PNG of the seat selection, when it is an image. Nil if the host cannot read pictures (windowed GLFW) or the selection is text.

Sources/LavaUI/TextField.swift:928

nonisolated(unsafe) static var primaryReader: (() -> String)?

The primary selection — what middle-click pastes. A second selection, filled by the act of selecting rather than by a copy command, which is why a widget writes it from wherever a drag ends rather than from a keybinding.

Separate closures rather than a flag, because the two are separate protocols under a compositor and the host wires whichever it has: left nil, primary simply does nothing, and middle-click pastes nothing.

Sources/LavaUI/TextField.swift:947

nonisolated(unsafe) static var primaryWriter: ((String) -> Void)?

Not documented.

Sources/LavaUI/TextField.swift:948

nonisolated(unsafe) static var reader: (() -> String)?

Not documented.

Sources/LavaUI/TextField.swift:924

nonisolated(unsafe) static var writer: ((String) -> Void)?

Not documented.

Sources/LavaUI/TextField.swift:925

Methods

static func read() -> String

Not documented.

Sources/LavaUI/TextField.swift:950

static func readImage() -> [UInt8]?

Not documented.

Sources/LavaUI/TextField.swift:952

static func readPrimary() -> String

Not documented.

Sources/LavaUI/TextField.swift:962

static func write(_ text: String)

Not documented.

Sources/LavaUI/TextField.swift:951

@discardableResult static func writeImage(file path: String) -> Bool

Not documented.

Sources/LavaUI/TextField.swift:957

static func writePrimary(_ text: String)

Not documented.

Sources/LavaUI/TextField.swift:963