From 25e4dbcfc1196478114a652d1f6604704bed21e0 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Fri, 15 Aug 2025 14:33:57 +0200 Subject: [PATCH] Fix Brightness (doesn't regenerate colors anymore) --- Modules/Settings/Tabs/DisplayTab.qml | 6 ++++-- Services/BrightnessService.qml | 4 ++++ Services/Settings.qml | 7 ++++++- Services/Wallpapers.qml | 9 ++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Modules/Settings/Tabs/DisplayTab.qml b/Modules/Settings/Tabs/DisplayTab.qml index c4694bd..3d1211a 100644 --- a/Modules/Settings/Tabs/DisplayTab.qml +++ b/Modules/Settings/Tabs/DisplayTab.qml @@ -77,8 +77,10 @@ Item { to: 50 value: Settings.data.brightness.brightnessStep stepSize: 1 - onMoved: { - Settings.data.brightness.brightnessStep = value + onPressedChanged: { + if (!pressed) { + Settings.data.brightness.brightnessStep = value + } } } diff --git a/Services/BrightnessService.qml b/Services/BrightnessService.qml index ce9e130..dc7104b 100644 --- a/Services/BrightnessService.qml +++ b/Services/BrightnessService.qml @@ -204,6 +204,8 @@ Singleton { } } + + function getStoredBrightness(): real { // Try to get stored brightness for this specific monitor var stored = Settings.data.brightness.monitorBrightness.find(m => m.name === modelData.name) @@ -283,6 +285,8 @@ Singleton { initProc.running = true } + + onBusNumChanged: initBrightness() Component.onCompleted: initBrightness() } diff --git a/Services/Settings.qml b/Services/Settings.qml index bc4568c..100ac64 100644 --- a/Services/Settings.qml +++ b/Services/Settings.qml @@ -24,6 +24,9 @@ Singleton { // Used to access via Settings.data.xxx.yyy property var data: adapter + + // Flag to prevent unnecessary wallpaper calls during reloads + property bool isInitialLoad: true // Needed to only have one NPanel loaded at a time. <--- VERY BROKEN //property var openPanel: null @@ -47,10 +50,12 @@ Singleton { onLoaded: function () { console.log("[Settings] Loaded") Qt.callLater(function () { - if (adapter.wallpaper.current !== "") { + // Only set wallpaper on initial load, not on reloads + if (isInitialLoad && adapter.wallpaper.current !== "") { console.log("[Settings] Set current wallpaper", adapter.wallpaper.current) Wallpapers.setCurrentWallpaper(adapter.wallpaper.current, true) } + isInitialLoad = false }) } onLoadFailed: function (error) { diff --git a/Services/Wallpapers.qml b/Services/Wallpapers.qml index a8d9847..301ab50 100644 --- a/Services/Wallpapers.qml +++ b/Services/Wallpapers.qml @@ -39,6 +39,8 @@ Singleton { } function setCurrentWallpaper(path, isInitial) { + // Only generate colors if the wallpaper actually changed + var wallpaperChanged = currentWallpaper !== path currentWallpaper = path if (!isInitial) { @@ -62,7 +64,10 @@ Singleton { randomWallpaperTimer.restart() } - generateColors() + // Only generate colors if the wallpaper actually changed + if (wallpaperChanged) { + generateColors() + } } function setRandomWallpaper() { @@ -91,7 +96,9 @@ Singleton { } function generateColors() { + console.log("[Wallpapers] generateColors() called, generateColors setting:", Settings.data.wallpaper.generateColors) if (Settings.data.wallpaper.generateColors) { + console.log("[Wallpapers] Starting color generation process") generateThemeProcess.running = true } }