From 84fdb7c6474738d336cca85bcbd885cfe5befd02 Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Thu, 4 Sep 2025 16:17:31 -0400 Subject: [PATCH] Wallpaper: added IPC to set a wallpaper qs -c noctalia-shell ipc call wallpaper set $path $monitor $monitor can be a monitor name or "all" or "" to assign to all monitors. --- Modules/IPC/IPCManager.qml | 7 +++++++ Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml | 4 ++-- Services/WallpaperService.qml | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Modules/IPC/IPCManager.qml b/Modules/IPC/IPCManager.qml index 15ae2d7..7436829 100644 --- a/Modules/IPC/IPCManager.qml +++ b/Modules/IPC/IPCManager.qml @@ -138,5 +138,12 @@ Item { WallpaperService.setRandomWallpaper() } } + + function set(path: string, screen: string) { + if (screen === "all" || screen === "") { + screen = undefined + } + WallpaperService.changeWallpaper(path, screen) + } } } diff --git a/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml b/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml index 8cf41dd..6952c71 100644 --- a/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml +++ b/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml @@ -210,9 +210,9 @@ ColumnLayout { hoverEnabled: true onPressed: { if (Settings.data.wallpaper.setWallpaperOnAllMonitors) { - WallpaperService.changeWallpaper(undefined, wallpaperPath) + WallpaperService.changeWallpaper(wallpaperPath, undefined) } else if (screen) { - WallpaperService.changeWallpaper(screen.name, wallpaperPath) + WallpaperService.changeWallpaper(wallpaperPath, screen.name) } } } diff --git a/Services/WallpaperService.qml b/Services/WallpaperService.qml index 705fb67..7f99a0d 100644 --- a/Services/WallpaperService.qml +++ b/Services/WallpaperService.qml @@ -220,7 +220,7 @@ Singleton { } // ------------------------------------------------------------------- - function changeWallpaper(screenName, path) { + function changeWallpaper(path, screenName) { if (screenName !== undefined) { _setWallpaper(screenName, path) } else { @@ -305,7 +305,7 @@ Singleton { if (wallpaperList.length > 0) { var randomIndex = Math.floor(Math.random() * wallpaperList.length) var randomPath = wallpaperList[randomIndex] - changeWallpaper(screenName, randomPath) + changeWallpaper(randomPath, screenName) } } } else { @@ -315,7 +315,7 @@ Singleton { if (wallpaperList.length > 0) { var randomIndex = Math.floor(Math.random() * wallpaperList.length) var randomPath = wallpaperList[randomIndex] - changeWallpaper(undefined, randomPath) + changeWallpaper(randomPath, undefined) } } }