From 2796c1cd4d3a236b6e91bb36f1ef6d90835286fa Mon Sep 17 00:00:00 2001 From: purian23 Date: Tue, 24 Feb 2026 21:23:36 -0500 Subject: [PATCH] fix: Defer DankCircularImage saving until the window is available --- quickshell/Widgets/DankCircularImage.qml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/quickshell/Widgets/DankCircularImage.qml b/quickshell/Widgets/DankCircularImage.qml index 45231487..d7911eac 100644 --- a/quickshell/Widgets/DankCircularImage.qml +++ b/quickshell/Widgets/DankCircularImage.qml @@ -1,4 +1,5 @@ import QtQuick +import QtQuick.Window import QtQuick.Effects import qs.Common import qs.Widgets @@ -18,9 +19,30 @@ Rectangle { signal imageSaved(string filePath) + property string _pendingSavePath: "" + property var _attachedWindow: root.Window.window + + on_AttachedWindowChanged: { + if (_attachedWindow && _pendingSavePath !== "") { + Qt.callLater(function () { + if (root._pendingSavePath !== "") { + let path = root._pendingSavePath; + root._pendingSavePath = ""; + root.saveImageToFile(path); + } + }); + } + } + function saveImageToFile(filePath) { if (activeImage.status !== Image.Ready) return false; + + if (!activeImage.Window.window) { + _pendingSavePath = filePath; + return true; + } + activeImage.grabToImage(function (result) { if (result && result.saveToFile(filePath)) { root.imageSaved(filePath);