diff --git a/modules/workspace.nix b/modules/workspace.nix index 4e37f333..4fa0e4a6 100644 --- a/modules/workspace.nix +++ b/modules/workspace.nix @@ -448,17 +448,33 @@ in desktopScript."wallpaper_picture" = ( lib.mkIf (cfg.workspace.wallpaper != null) { - # We just put this here as we need this script to be a desktop-script in - # order to link it together with the other desktop-script (namely - # panels). Adding a comment with the wallpaper makes it so that when the - # wallpaper changes, the sha256sum also changes for the js file, which - # gives us the correct behavior with last_run files. - text = "// Wallpaper to set later: ${cfg.workspace.wallpaper}"; - postCommands = '' - plasma-apply-wallpaperimage ${cfg.workspace.wallpaper} ${ - lib.optionalString ( - cfg.workspace.wallpaperFillMode != null - ) "--fill-mode ${cfg.workspace.wallpaperFillMode}" + text = '' + let allDesktops = desktops(); + for (const desktop of allDesktops) { + desktop.wallpaperPlugin = "org.kde.image"; + desktop.currentConfigGroup = ["Wallpaper", "org.kde.image", "General"]; + desktop.writeConfig("Image", "file://${cfg.workspace.wallpaper}"); + ${ + lib.optionalString (cfg.workspace.wallpaperFillMode != null) + ''desktop.writeConfig("FillMode", "${ + toString wallpaperFillModeTypes.${cfg.workspace.wallpaperFillMode} + }");'' + } + ${ + lib.optionalString + (cfg.workspace.wallpaperBackground != null || cfg.workspace.wallpaperBackground != { }) + ''desktop.writeConfig("${ + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + "Blur" + else + "Color" + }", "${ + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + lib.boolToString cfg.workspace.wallpaperBackground.blur + else + cfg.workspace.wallpaperBackground.color + }");'' + } } ''; priority = 3;