Add event-driven wallpaper rotation

This commit is contained in:
Gabriel Brown
2026-08-18 15:00:18 -04:00
parent 52818b7290
commit 1c12892252
3 changed files with 160 additions and 4 deletions
@@ -7,8 +7,10 @@ import qs.services
ShellRoot {
Component.onCompleted: {
Wallpaper.outputNames = function() { return ["DP-2", "HDMI-A-1"]; };
Wallpaper.outputOverride = ["DP-2", "HDMI-A-1"];
Wallpaper.candidateOverride = ["/images/a.jpg", "/images/b.jpg", "/images/c.jpg"];
Wallpaper.startupRestoreEnabled = false;
Wallpaper.slideshowIntervalOverrideMs = 60000;
Wallpaper.available = ["/images/a.jpg", "/images/b.jpg", "/images/c.jpg"];
}
@@ -31,6 +33,25 @@ ShellRoot {
return Wallpaper.set(path);
}
function seedSlideshow(paths: string, shuffle: bool): void {
DesktopPreferences.set("wallpaperMode", "slideshow");
DesktopPreferences.set("wallpaperPath", "/images/a.jpg");
DesktopPreferences.set("wallpaperSlideshowPaths", JSON.parse(paths));
DesktopPreferences.set("wallpaperShuffle", shuffle);
Wallpaper.slideshowPath = "/images/a.jpg";
Wallpaper.shuffleBag = [];
}
function advanceSlideshow(): bool {
return Wallpaper.advanceSlideshow();
}
function rapidOutputs(): void {
Wallpaper.outputOverride = ["DP-2"];
Wallpaper.outputOverride = ["HDMI-A-1"];
Wallpaper.outputOverride = ["DP-2", "HDMI-A-1"];
}
function status(): string {
return JSON.stringify({
busy: Wallpaper.busy,
@@ -39,7 +60,10 @@ ShellRoot {
active: Wallpaper.active,
mode: DesktopPreferences.get("wallpaperMode"),
path: DesktopPreferences.get("wallpaperPath"),
assignments: DesktopPreferences.get("wallpaperPerMonitor")
assignments: DesktopPreferences.get("wallpaperPerMonitor"),
slideshowPath: Wallpaper.slideshowPath,
shuffleBag: Wallpaper.shuffleBag,
slideshowTimerRunning: Wallpaper.slideshowTimerRunning
});
}
}