Fix first start noctalia settings & color creation

This commit is contained in:
Ly-sec 2025-09-08 07:51:49 +02:00
parent 849f3c52d7
commit 38928abab7
2 changed files with 25 additions and 12 deletions

View file

@ -102,7 +102,7 @@ Singleton {
// FileView to load custom colors data from colors.json
FileView {
id: customColorsFile
path: Settings.configDir + "colors.json"
path: Settings.directoriesCreated ? (Settings.configDir + "colors.json") : ""
watchChanges: true
onFileChanged: {
Logger.log("Color", "Reloading colors from disk")
@ -112,6 +112,13 @@ Singleton {
Logger.log("Color", "Writing colors to disk")
writeAdapter()
}
// Trigger initial load when path changes from empty to actual path
onPathChanged: {
if (path === Settings.configDir + "colors.json") {
reload()
}
}
onLoadFailed: function (error) {
if (error.toString().includes("No such file") || error === 2) {
// File doesn't exist, create it with default values