Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/opencode/src/cli/cmd/tui/util/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ export namespace Clipboard {
} finally {
await $`rm -f "${tmpfile}"`.nothrow().quiet()
}

try {
const filepath = await $`osascript -e 'POSIX path of (the clipboard as "furl")'`.nothrow().text()
if (filepath) {
const file = Bun.file(filepath.trim())
const buffer = await file.arrayBuffer()
const mimeType = file.type
if (mimeType.startsWith("image/") && buffer.byteLength > 0) {
return { data: Buffer.from(buffer).toString("base64"), mime: mimeType }
}
}
} catch {}
}

if (os === "win32" || release().includes("WSL")) {
Expand Down