qs: no its not :(

This commit is contained in:
2026-03-18 05:49:10 +01:00
parent bde4fe1c72
commit 98fecc6f41
2 changed files with 42 additions and 24 deletions
@@ -20,8 +20,8 @@ Variants {
PanelWindow { PanelWindow {
id: bgWindow id: bgWindow
readonly property bool doBlur: BarService.focusMode && (BackgroundService.previewPath === "") readonly property bool doBlur: BarService.focusMode && !BackgroundService.inPreviewMode
readonly property string imagePath: BackgroundService.previewPath || BackgroundService.cachedPath readonly property string imagePath: BackgroundService.displayPath
screen: modelData screen: modelData
WlrLayershell.namespace: "quickshell-background" WlrLayershell.namespace: "quickshell-background"
@@ -133,7 +133,7 @@ Variants {
id: bdWindow id: bdWindow
property bool doBlur: true property bool doBlur: true
property string imagePath: BackgroundService.cachedPath property string imagePath: BackgroundService.displayPath
screen: modelData screen: modelData
WlrLayershell.namespace: "quickshell-backdrop" WlrLayershell.namespace: "quickshell-backdrop"
@@ -11,8 +11,10 @@ Singleton {
readonly property string backgroundWidth: "2560" readonly property string backgroundWidth: "2560"
readonly property string backgroundHeight: "1440" readonly property string backgroundHeight: "1440"
property string cachedPath: "" property string _cachedPath: ""
property string previewPath: "" property string _previewPath: ""
property string displayPath: ""
property bool inPreviewMode: false
// Preserved for getBlurredOverview // Preserved for getBlurredOverview
readonly property string tintColor: Colors.mSurface readonly property string tintColor: Colors.mSurface
readonly property real tintOpacity: 0.5 readonly property real tintOpacity: 0.5
@@ -29,22 +31,25 @@ Singleton {
Logger.e("BackgroundService", "Failed to load background image from path: " + SettingsService.backgroundPath); Logger.e("BackgroundService", "Failed to load background image from path: " + SettingsService.backgroundPath);
return ; return ;
} }
cachedPath = path; _cachedPath = path;
Logger.i("BackgroundService", "Loaded background image as cached path: " + path); Logger.i("BackgroundService", "Loaded background image as cached path: " + path);
setDisplayTimer.restart();
}); });
} }
function previewWallpaper(path) { function previewWallpaper(path) {
if (!path) { if (!path) {
previewPath = ""; _previewPath = "";
setDisplayTimer.restart();
return ; return ;
} }
ImageCacheService.checkFileExists(path, function(exists) { ImageCacheService.checkFileExists(path, function(exists) {
if (!exists) { if (!exists) {
previewPath = ""; _previewPath = "";
return ; return ;
} }
previewPath = path; _previewPath = path;
setDisplayTimer.restart();
}); });
} }
@@ -52,14 +57,15 @@ Singleton {
if (!path) if (!path)
return ; return ;
previewPath = ""; // clear preview path _previewPath = ""; // clear preview path
cachedPath = ""; // clear cached path _cachedPath = ""; // clear cached path
setDisplayTimer.restart();
ImageCacheService.checkFileExists(path, function(exists) { ImageCacheService.checkFileExists(path, function(exists) {
if (!exists) if (!exists)
return ; return ;
SettingsService.backgroundPath = path; SettingsService.backgroundPath = path;
loadWallpaperDebouncer.start(); loadTimer.restart();
}); });
} }
@@ -70,25 +76,37 @@ Singleton {
} }
Component.onCompleted: { Component.onCompleted: {
loadWallpaperDebouncer.start(); loadTimer.start();
}
Connections {
function onBackgroundPathChanged() {
loadWallpaperDebouncer.start();
}
target: SettingsService
} }
Timer { Timer {
id: loadWallpaperDebouncer id: loadTimer
interval: 200 interval: 300
running: false running: false
repeat: false repeat: false
onTriggered: { onTriggered: {
root.loadBackground(); loadBackground();
}
}
Timer {
id: setDisplayTimer
interval: 100
running: false
repeat: false
onTriggered: {
if (root._previewPath) {
root.displayPath = root._previewPath;
root.inPreviewMode = true;
} else if (root._cachedPath) {
root.displayPath = root._cachedPath;
root.inPreviewMode = false;
} else {
root.displayPath = "";
root.inPreviewMode = false;
}
} }
} }