Add WallpaperSelector, add some scrolling in SettingsWindow

This commit is contained in:
Ly-sec 2025-08-12 17:26:23 +02:00
parent eff47f504f
commit 8155ef20eb
14 changed files with 1451 additions and 674 deletions

View file

@ -11,8 +11,13 @@ Singleton {
Item {
Component.onCompleted: {
loadWallpapers()
setCurrentWallpaper(currentWallpaper, true)
toggleRandomWallpaper()
// Only set initial wallpaper if it's not empty
if (currentWallpaper !== "") {
console.log("Wallpapers: Initializing with wallpaper:", currentWallpaper)
setCurrentWallpaper(currentWallpaper, true)
}
// Don't start random wallpaper during initialization
// toggleRandomWallpaper()
}
}
@ -20,7 +25,7 @@ Singleton {
property string currentWallpaper: Settings.data.wallpaper.current
property bool scanning: false
property string transitionType: Settings.data.wallpaper.swww.transitionType
property var randomChoices: ["fade", "left", "right", "top", "bottom", "wipe", "wave", "grow", "center", "any", "outer"]
property var randomChoices: ["simple", "fade", "left", "right", "top", "bottom", "wipe", "wave", "grow", "center", "any", "outer"]
function loadWallpapers() {
scanning = true
@ -29,10 +34,12 @@ Singleton {
}
function changeWallpaper(path) {
setCurrentWallpaper(path)
console.log("Wallpapers: changeWallpaper called with:", path)
setCurrentWallpaper(path, false)
}
function setCurrentWallpaper(path, isInitial) {
console.log("Wallpapers: Setting wallpaper to:", path, "isInitial:", isInitial)
currentWallpaper = path
if (!isInitial) {
Settings.data.wallpaper.current = path
@ -43,7 +50,11 @@ Singleton {
} else {
transitionType = Settings.data.wallpaper.swww.transitionType
}
console.log("SWWW: Changing wallpaper with transition type:", transitionType)
changeWallpaperProcess.running = true
} else {
// Fallback: update the settings directly for non-SWWW mode
console.log("Non-SWWW mode: Setting wallpaper directly")
}
if (randomWallpaperTimer.running) {
@ -59,7 +70,7 @@ Singleton {
if (!randomPath) {
return
}
setCurrentWallpaper(randomPath)
setCurrentWallpaper(randomPath, false)
}
function toggleRandomWallpaper() {
@ -84,6 +95,13 @@ Singleton {
}
}
function startSWWWDaemon() {
if (Settings.data.wallpaper.swww.enabled) {
console.log("SWWW: Attempting to start swww-daemon...")
startDaemonProcess.running = true
}
}
Timer {
id: randomWallpaperTimer
interval: Settings.data.wallpaper.randomInterval * 1000
@ -120,6 +138,18 @@ Singleton {
), "--transition-type", transitionType, "--transition-duration", Settings.data.wallpaper.swww.transitionDuration.toString(
), currentWallpaper]
running: false
onStarted: {
console.log("SWWW: Process started with command:", command.join(" "))
}
onExited: function(exitCode, exitStatus) {
console.log("SWWW: Process finished with exit code:", exitCode, "status:", exitStatus)
if (exitCode !== 0) {
console.log("SWWW: Process failed. Make sure swww-daemon is running with: swww-daemon")
console.log("SWWW: You can start it with: swww-daemon --format xrgb")
}
}
}
Process {
@ -128,4 +158,23 @@ Singleton {
workingDirectory: Quickshell.shellDir
running: false
}
Process {
id: startDaemonProcess
command: ["swww-daemon", "--format", "xrgb"]
running: false
onStarted: {
console.log("SWWW: Daemon start process initiated")
}
onExited: function(exitCode, exitStatus) {
console.log("SWWW: Daemon start process finished with exit code:", exitCode)
if (exitCode === 0) {
console.log("SWWW: Daemon started successfully")
} else {
console.log("SWWW: Failed to start daemon. It might already be running.")
}
}
}
}