Fix image selector IPC reloads

This commit is contained in:
David Heinemeier Hansson
2026-06-24 13:49:22 +02:00
parent c43afa52ac
commit 89abbddc77
4 changed files with 86 additions and 43 deletions
+56
View File
@@ -752,6 +752,62 @@ ShellRoot {
}
}
// --------------------------------------------------- image selector IPC
function imagePickerItem() {
var loader = panelLoaders["omarchy.image-picker"]
return loader && loader.item ? loader.item : null
}
IpcHandler {
target: "image-selector"
function open(imageDirs: string,
imageRowsB64: string,
selectedImage: string,
selectionFile: string,
doneFile: string,
showLabels: string,
filterable: string): string {
var payload = JSON.stringify({
imageDirs: imageDirs,
imageRows: Util.decodeBase64(imageRowsB64),
selectedImage: selectedImage,
selectionFile: selectionFile,
doneFile: doneFile,
showLabels: showLabels,
filterable: filterable
})
return shell.summon("omarchy.image-picker", payload) ? "ok" : "unknown"
}
function preload(imageRowsB64: string,
selectedImage: string,
showLabels: string,
filterable: string): string {
var picker = shell.imagePickerItem()
if (picker && typeof picker.preloadRows === "function") {
picker.preloadRows(Util.decodeBase64(imageRowsB64), selectedImage,
showLabels, filterable)
}
return "ok"
}
function cancel(doneFile: string): string {
var picker = shell.imagePickerItem()
if (picker && typeof picker.closeSelector === "function") {
picker.closeSelector(doneFile || "")
} else {
shell.hide("omarchy.image-picker")
}
return "ok"
}
function ping(): string {
return "ok"
}
}
// ---------------------------------------------------------- shell IPC
IpcHandler {