summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-08-17 13:17:16 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-08-18 00:44:22 +0800
commitce151940fa69355c357faea91bd01e8c94b2e64f (patch)
treeaf68abcb2b46569eaddd67481cd52169b2ddf6e8
parent1078ef324f8e83a4390fcc5e565119dff9228c8c (diff)
clip: recognize more types
-rw-r--r--launcher/components/Clip.qml4
-rw-r--r--services/Clip.qml13
2 files changed, 14 insertions, 3 deletions
diff --git a/launcher/components/Clip.qml b/launcher/components/Clip.qml
index c342d44..2f709e9 100644
--- a/launcher/components/Clip.qml
+++ b/launcher/components/Clip.qml
@@ -101,7 +101,7 @@ IComponent {
Column {
Loader {
- sourceComponent: modelData?.isImage ? img : text
+ sourceComponent: modelData?.type === "image" ? img : text
readonly property Component text: IText {
text: modelData?.data || ""
font.pixelSize: Style.font.size.largerr
@@ -113,7 +113,7 @@ IComponent {
Row {
spacing: Launcher.innerMargin
IText {
- text: modelData.isImage ? "Image" : "Text"
+ text: modelData.type
color: Colors.foreground3
font.pixelSize: Style.font.size.normal
}
diff --git a/services/Clip.qml b/services/Clip.qml
index 622b293..4b289a0 100644
--- a/services/Clip.qml
+++ b/services/Clip.qml
@@ -21,6 +21,17 @@ Searchable {
property var _clipMetadata: ({})
+ function getType(text: string): string {
+ if (!text)
+ return;
+ if (text.startsWith("http://") || text.startsWith("https://"))
+ return "web";
+ if (text.startsWith("file://"))
+ return "file";
+
+ return "text";
+ }
+
list: {
if (!_clipHist?.length)
return [];
@@ -50,7 +61,7 @@ Searchable {
return {
index: idNum,
- isImage: isImg,
+ type: isImg ? "image" : root.getType(payload),
data: isImg ? imgPath : payload,
raw: raw,
timestamp: metadata.timestamp || "",