Fix large clipboard history pastes

Clipboard history selections passed the full selected text as a process argument to omarchy-clipboard-paste-text. Large entries can exceed Linux's per-argument exec limit, so the helper never starts reliably for big copied blocks.

Pass the original history index instead and have the helper read that entry from clipboard-history.json before wl-copy and Shift+Insert. Also focus the first row when opening the manager, keep filtered rows mapped to their original history indexes, and drop whitespace-only text entries.
This commit is contained in:
David Heinemeier Hansson
2026-05-29 12:21:28 +02:00
parent 6be9b8b6d9
commit e79013adbe
4 changed files with 74 additions and 12 deletions
+2 -2
View File
@@ -40,7 +40,7 @@ Item {
root.opened = true
root.filterText = ""
root.selectedIndex = 0
root.cursorActive = false
root.cursorActive = true
root.rebuildDisplay()
Qt.callLater(function() { keyCatcher.forceActiveFocus() })
}
@@ -140,7 +140,7 @@ Item {
if (row.entryType === "image") {
Quickshell.execDetached([root.omarchyPath + "/bin/omarchy-clipboard-paste-file", row.mime, row.path])
} else if (row.fullText) {
Quickshell.execDetached([root.omarchyPath + "/bin/omarchy-clipboard-paste-text", "--shift-insert", row.fullText])
Quickshell.execDetached([root.omarchyPath + "/bin/omarchy-clipboard-paste-text", "--shift-insert", "--history-index", String(row.index)])
}
}
+3 -3
View File
@@ -1,13 +1,13 @@
function normalizeEntry(value) {
if (typeof value === "string")
return value.length > 0 ? { type: "text", text: value } : null
return value.trim().length > 0 ? { type: "text", text: value } : null
if (!value || typeof value !== "object") return null
var type = String(value.type || value.kind || "")
if (type === "text") {
var text = String(value.text || "")
return text.length > 0 ? { type: "text", text: text } : null
return text.trim().length > 0 ? { type: "text", text: text } : null
}
if (type === "image") {
@@ -107,7 +107,7 @@ function displayRows(history, query, limit) {
previewImage: isImage ? String(entry.path || "") : "",
path: isImage ? String(entry.path || "") : "",
mime: isImage ? String(entry.mime || "image/png") : "text/plain",
index: rows.length
index: i
})
if (rows.length >= max) break
}