summaryrefslogtreecommitdiff
path: root/services/Persistent.qml
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-08-16 16:23:20 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-08-16 16:23:20 +0800
commit4fe12bbabfe2bb4c468c66348afedb34aee0b783 (patch)
tree904ce21bf2b39d988483d91a585a23ede5da424b /services/Persistent.qml
parentc4eca807dacd407af939c2200055acb4326ccfe0 (diff)
feat(Clip): metadatas(app it's taken from, timestamp)
Persistent and Directories are partially copied from end4-dots which is GPL Licensed
Diffstat (limited to 'services/Persistent.qml')
-rw-r--r--services/Persistent.qml27
1 files changed, 27 insertions, 0 deletions
diff --git a/services/Persistent.qml b/services/Persistent.qml
new file mode 100644
index 0000000..3a911bf
--- /dev/null
+++ b/services/Persistent.qml
@@ -0,0 +1,27 @@
+import QtQuick
+import Quickshell
+import Quickshell.Io
+import qs.utils
+
+Scope {
+ id: root
+ property alias adapter: fileView.adapter
+ property alias fileView: fileView
+ property string fileDir: Directories.state
+ property string fileName: "states.json"
+ property string filePath: `${root.fileDir}/${root.fileName}`
+
+ FileView {
+ id: fileView
+ path: root.filePath
+ watchChanges: true
+ onFileChanged: reload()
+ onAdapterUpdated: writeAdapter()
+ onLoadFailed: error => {
+ console.log("Failed to load persistent states file:", error);
+ if (error == FileViewError.FileNotFound) {
+ writeAdapter();
+ }
+ }
+ }
+}