summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorTim Hämisch <haemtim@gmail.com>2025-06-13 17:49:49 +0200
committerGitHub <noreply@github.com>2025-06-13 17:49:49 +0200
commit5fb727a4c8d9e89acc63a1c353202423bc7b120e (patch)
tree28839211a383025df53168993d090cdccaa9bf7a /services
parentAdd shutdown, reboot, and logout actions to launcher (diff)
parentdocs: add contributing.md (diff)
downloadcaelestia-shell-5fb727a4c8d9e89acc63a1c353202423bc7b120e.tar.gz
caelestia-shell-5fb727a4c8d9e89acc63a1c353202423bc7b120e.tar.bz2
caelestia-shell-5fb727a4c8d9e89acc63a1c353202423bc7b120e.zip
Merge branch 'caelestia-dots:main' into betteractions
Diffstat (limited to 'services')
-rw-r--r--services/Thumbnailer.qml72
1 files changed, 0 insertions, 72 deletions
diff --git a/services/Thumbnailer.qml b/services/Thumbnailer.qml
deleted file mode 100644
index 6a6066c..0000000
--- a/services/Thumbnailer.qml
+++ /dev/null
@@ -1,72 +0,0 @@
-pragma Singleton
-pragma ComponentBehavior: Bound
-
-import "root:/utils"
-import Quickshell
-import Quickshell.Io
-import QtQuick
-
-Singleton {
- id: root
-
- readonly property string thumbDir: `${Paths.cache}/thumbnails`.slice(7)
-
- function go(obj: var): var {
- return thumbComp.createObject(obj, {
- originalPath: obj.path,
- width: obj.width,
- height: obj.height,
- loadOriginal: obj.loadOriginal
- });
- }
-
- component Thumbnail: QtObject {
- id: obj
-
- required property string originalPath
- required property int width
- required property int height
- required property bool loadOriginal
-
- property string path
-
- readonly property Process proc: Process {
- running: true
- command: ["fish", "-c", `
-set -l path "${root.thumbDir}/$(sha1sum ${obj.originalPath} | cut -d ' ' -f 1)@${obj.width}x${obj.height}-exact.png"
-if test -f $path
- echo $path
-else
- echo 'start'
- set -l size (identify -ping -format '%w\n%h' ${obj.originalPath})
- if test $size[1] -gt ${obj.width} -o $size[2] -gt ${obj.height}
- magick ${obj.originalPath} -${obj.width > 1024 || obj.height > 1024 ? "resize" : "thumbnail"} ${obj.width}x${obj.height}^ -background none -gravity center -extent ${obj.width}x${obj.height} -unsharp 0x.5 $path
- else
- cp ${obj.originalPath} $path
- end
- echo $path
-end`]
- stdout: SplitParser {
- onRead: data => {
- if (data === "start") {
- if (obj.loadOriginal)
- obj.path = obj.originalPath;
- } else {
- obj.path = data;
- }
- }
- }
- }
-
- function reload(): void {
- proc.signal(9);
- proc.running = true;
- }
- }
-
- Component {
- id: thumbComp
-
- Thumbnail {}
- }
-}