Merge branch 'advanced-wallpaper'

This commit is contained in:
LemmyCook 2025-08-29 17:02:17 -04:00
commit 8f3f520ef4
18 changed files with 646 additions and 658 deletions

View file

@ -17,6 +17,14 @@ Singleton {
}
}
function _getStackTrace() {
try {
throw new Error("Stack trace")
} catch (e) {
return e.stack
}
}
function log(...args) {
var msg = _formatMessage(...args)
console.log(msg)
@ -31,4 +39,20 @@ Singleton {
var msg = _formatMessage(...args)
console.error(msg)
}
function callStack() {
var stack = _getStackTrace()
Logger.log("Debug", "--------------------------")
Logger.log("Debug", "Current call stack")
// Split the stack into lines and log each one
var stackLines = stack.split('\n')
for (var i = 0; i < stackLines.length; i++) {
var line = stackLines[i].trim() // Remove leading/trailing whitespace
if (line.length > 0) {
// Only log non-empty lines
Logger.log("Debug", `- ${line}`)
}
}
Logger.log("Debug", "--------------------------")
}
}

View file

@ -89,23 +89,16 @@ Singleton {
reload()
}
onLoaded: function () {
Qt.callLater(function () {
// Some stuff like wallpaper setup and settings validation should just be executed once on startup
// And not on every reload
if (!isLoaded) {
Logger.log("Settings", "JSON completed loading")
if (adapter.wallpaper.current !== "") {
Logger.log("Settings", "Set current wallpaper", adapter.wallpaper.current)
WallpaperService.setCurrentWallpaper(adapter.wallpaper.current, true)
}
if (!isLoaded) {
Logger.log("Settings", "----------------------------")
Logger.log("Settings", "Settings loaded successfully")
isLoaded = true
// Validate monitor configurations, only once
// if none of the configured monitors exist, clear the lists
Qt.callLater(function () {
// Some stuff like settings validation should just be executed once on startup and not on every reload
validateMonitorConfigurations()
isLoaded = true
}
})
})
}
}
onLoadFailed: function (error) {
if (error.toString().includes("No such file") || error === 2)
@ -171,22 +164,13 @@ Singleton {
// wallpaper
property JsonObject wallpaper: JsonObject {
property string directory: "/usr/share/wallpapers"
property string current: ""
property bool isRandom: false
property int randomInterval: 300
property JsonObject swww
onDirectoryChanged: WallpaperService.listWallpapers()
onIsRandomChanged: WallpaperService.toggleRandomWallpaper()
onRandomIntervalChanged: WallpaperService.restartRandomWallpaperTimer()
swww: JsonObject {
property bool enabled: false
property string resizeMethod: "crop"
property int transitionFps: 60
property string transitionType: "random"
property real transitionDuration: 1.1
}
property bool enableMultiMonitorDirectories: false
property bool setWallpaperOnAllMonitors: true
property bool randomEnabled: false
property int randomIntervalSec: 300 // 5 min
property int transitionDuration: 1500 // 1500 ms
property string transitionType: "fade"
property list<var> monitors: []
}
// applauncher
@ -234,19 +218,10 @@ Singleton {
property string fontDefault: "Roboto" // Default font for all text
property string fontFixed: "DejaVu Sans Mono" // Fixed width font for terminal
property string fontBillboard: "Inter" // Large bold font for clocks and prominent displays
// Legacy compatibility
property string fontFamily: fontDefault // Keep for backward compatibility
// Idle inhibitor state
property list<var> monitorsScaling: []
property bool idleInhibitorEnabled: false
}
// Scaling (not stored inside JsonObject, or it crashes)
property var monitorsScaling: {
}
// brightness
property JsonObject brightness: JsonObject {
property int brightnessStep: 5