This commit is contained in:
Zacharias-Brohn
2025-10-07 23:22:46 +02:00
parent 0da7e57a64
commit f6d25c98a6
10 changed files with 727 additions and 70 deletions
+53
View File
@@ -0,0 +1,53 @@
pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
import Qt.labs.platform
Singleton {
id: root
// refer https://doc.qt.io/qt-6/qstandardpaths.html#StandardLocation-enum
// god fucking knows how soramane found this
readonly property url cache: `${StandardPaths.standardLocations(StandardPaths.GenericCacheLocation)[0]}/kurukurubar`
readonly property url config: `${StandardPaths.standardLocations(StandardPaths.GenericConfigLocation)[0]}/kurukurubar`
function getPath(caller, url: string): string {
let filename = url.split('/').pop();
let filepath = root.cache + "/" + filename;
let script = root.urlToPath(Qt.resolvedUrl("../scripts/cacheImg.sh"));
let process = cacheImg.incubateObject(root, {
"command": ["bash", script, url, root.urlToPath(root.cache)],
"running": true
});
process.onStatusChanged = function (status) {
if (status != Component.Ready) {
return;
}
process.object.exited.connect((eCode, eStat) => {
if (eCode == 0) {
caller.source = filepath;
} else {
console.log("[ERROR] cacheImg exited with error code: " + eCode);
}
process.object.destroy();
});
};
return "";
}
function urlToPath(url: url): string {
return url.toString().replace("file://", "");
}
Component {
id: cacheImg
Process {
}
}
}