Fix Brightness (doesn't regenerate colors anymore)

This commit is contained in:
Ly-sec 2025-08-15 14:33:57 +02:00
parent 860a65b9ca
commit 25e4dbcfc1
4 changed files with 22 additions and 4 deletions

View file

@ -77,10 +77,12 @@ Item {
to: 50 to: 50
value: Settings.data.brightness.brightnessStep value: Settings.data.brightness.brightnessStep
stepSize: 1 stepSize: 1
onMoved: { onPressedChanged: {
if (!pressed) {
Settings.data.brightness.brightnessStep = value Settings.data.brightness.brightnessStep = value
} }
} }
}
NText { NText {
text: Settings.data.brightness.brightnessStep + "%" text: Settings.data.brightness.brightnessStep + "%"

View file

@ -204,6 +204,8 @@ Singleton {
} }
} }
function getStoredBrightness(): real { function getStoredBrightness(): real {
// Try to get stored brightness for this specific monitor // Try to get stored brightness for this specific monitor
var stored = Settings.data.brightness.monitorBrightness.find(m => m.name === modelData.name) var stored = Settings.data.brightness.monitorBrightness.find(m => m.name === modelData.name)
@ -283,6 +285,8 @@ Singleton {
initProc.running = true initProc.running = true
} }
onBusNumChanged: initBrightness() onBusNumChanged: initBrightness()
Component.onCompleted: initBrightness() Component.onCompleted: initBrightness()
} }

View file

@ -25,6 +25,9 @@ Singleton {
// Used to access via Settings.data.xxx.yyy // Used to access via Settings.data.xxx.yyy
property var data: adapter 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 // Needed to only have one NPanel loaded at a time. <--- VERY BROKEN
//property var openPanel: null //property var openPanel: null
Item { Item {
@ -47,10 +50,12 @@ Singleton {
onLoaded: function () { onLoaded: function () {
console.log("[Settings] Loaded") console.log("[Settings] Loaded")
Qt.callLater(function () { 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) console.log("[Settings] Set current wallpaper", adapter.wallpaper.current)
Wallpapers.setCurrentWallpaper(adapter.wallpaper.current, true) Wallpapers.setCurrentWallpaper(adapter.wallpaper.current, true)
} }
isInitialLoad = false
}) })
} }
onLoadFailed: function (error) { onLoadFailed: function (error) {

View file

@ -39,6 +39,8 @@ Singleton {
} }
function setCurrentWallpaper(path, isInitial) { function setCurrentWallpaper(path, isInitial) {
// Only generate colors if the wallpaper actually changed
var wallpaperChanged = currentWallpaper !== path
currentWallpaper = path currentWallpaper = path
if (!isInitial) { if (!isInitial) {
@ -62,8 +64,11 @@ Singleton {
randomWallpaperTimer.restart() randomWallpaperTimer.restart()
} }
// Only generate colors if the wallpaper actually changed
if (wallpaperChanged) {
generateColors() generateColors()
} }
}
function setRandomWallpaper() { function setRandomWallpaper() {
var randomIndex = Math.floor(Math.random() * wallpaperList.length) var randomIndex = Math.floor(Math.random() * wallpaperList.length)
@ -91,7 +96,9 @@ Singleton {
} }
function generateColors() { function generateColors() {
console.log("[Wallpapers] generateColors() called, generateColors setting:", Settings.data.wallpaper.generateColors)
if (Settings.data.wallpaper.generateColors) { if (Settings.data.wallpaper.generateColors) {
console.log("[Wallpapers] Starting color generation process")
generateThemeProcess.running = true generateThemeProcess.running = true
} }
} }