From f23ced82012a9f85739210aa333cd6f92815c50a Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 17 Aug 2025 12:55:36 +0800 Subject: fix(Clip): image support --- launcher/components/Clip.qml | 12 +++++++++--- services/Clip.qml | 9 +++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/launcher/components/Clip.qml b/launcher/components/Clip.qml index 29b5959..c342d44 100644 --- a/launcher/components/Clip.qml +++ b/launcher/components/Clip.qml @@ -100,9 +100,15 @@ IComponent { } Column { - IText { - text: modelData?.data || "" - font.pixelSize: Style.font.size.largerr + Loader { + sourceComponent: modelData?.isImage ? img : text + readonly property Component text: IText { + text: modelData?.data || "" + font.pixelSize: Style.font.size.largerr + } + readonly property Component img: Image { + source: modelData?.data || "" + } } Row { spacing: Launcher.innerMargin diff --git a/services/Clip.qml b/services/Clip.qml index bd662ca..5feb1fb 100644 --- a/services/Clip.qml +++ b/services/Clip.qml @@ -45,10 +45,9 @@ Searchable { } } - const idStr = idNum >= 0 ? "" + idNum : ""; - const imgPath = idStr ? imgMap[idStr] || "" : ""; + const imgPath = idNum >= 0 ? imgMap[idNum] || "" : ""; const isImg = !!imgPath; - const metadata = _clipMetadata[idStr] || {}; + const metadata = _clipMetadata[idNum] || {}; return { index: idNum, @@ -58,7 +57,9 @@ Searchable { timestamp: metadata.timestamp || "", appId: metadata.appId || "", appTitle: metadata.appTitle || "", - appIcon: Quickshell.iconPath(AppSearch.guessIcon(metadata.appId), "image-missing") + appIcon: Quickshell.iconPath(AppSearch.guessIcon(metadata.appId), "image-missing"), + image: imgPath, + decoded: root._clipDecoded[idx] || "" }; }); } -- cgit v1.2.3