From cb982e9f860fb34e088b867741deef0281ddb304 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Sat, 30 Nov 2024 19:41:07 -0300 Subject: [PATCH 1/8] feat(workspace): add `wallpaperBackground` support for `wallpaper` --- modules/workspace.nix | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) 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; From 95d449879832e00615fec41d139dcf1736191c73 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Mon, 2 Dec 2024 11:14:47 -0300 Subject: [PATCH 2/8] possible fix? --- modules/workspace.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/workspace.nix b/modules/workspace.nix index 4fa0e4a6..e28e69b5 100644 --- a/modules/workspace.nix +++ b/modules/workspace.nix @@ -453,7 +453,7 @@ in for (const desktop of allDesktops) { desktop.wallpaperPlugin = "org.kde.image"; desktop.currentConfigGroup = ["Wallpaper", "org.kde.image", "General"]; - desktop.writeConfig("Image", "file://${cfg.workspace.wallpaper}"); + desktop.writeConfig("Image", "file://${toString cfg.workspace.wallpaper}"); ${ lib.optionalString (cfg.workspace.wallpaperFillMode != null) ''desktop.writeConfig("FillMode", "${ From b525135c1e69533f8bfcf38142de5eac8a01bb0c Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Wed, 4 Dec 2024 09:24:01 -0300 Subject: [PATCH 3/8] fix? --- modules/workspace.nix | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/modules/workspace.nix b/modules/workspace.nix index e28e69b5..faaf4fad 100644 --- a/modules/workspace.nix +++ b/modules/workspace.nix @@ -464,12 +464,9 @@ in 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 != null then "Blur" else "Color" }", "${ - if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur else cfg.workspace.wallpaperBackground.color @@ -503,12 +500,9 @@ in 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 != null then "Blur" else "Color" }", "${ - if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur else cfg.workspace.wallpaperBackground.color @@ -563,12 +557,9 @@ in 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 != null then "Blur" else "Color" }", "${ - if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur else cfg.workspace.wallpaperBackground.color From f34b93e0b52eb71d95e0252d269ce34b7d98c6c3 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Thu, 5 Dec 2024 11:12:38 -0300 Subject: [PATCH 4/8] Revert "fix?" This reverts commit b525135c1e69533f8bfcf38142de5eac8a01bb0c. --- modules/workspace.nix | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/workspace.nix b/modules/workspace.nix index faaf4fad..e28e69b5 100644 --- a/modules/workspace.nix +++ b/modules/workspace.nix @@ -464,9 +464,12 @@ in lib.optionalString (cfg.workspace.wallpaperBackground != null || cfg.workspace.wallpaperBackground != { }) ''desktop.writeConfig("${ - if cfg.workspace.wallpaperBackground.blur != null then "Blur" else "Color" + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + "Blur" + else + "Color" }", "${ - if cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur else cfg.workspace.wallpaperBackground.color @@ -500,9 +503,12 @@ in lib.optionalString (cfg.workspace.wallpaperBackground != null || cfg.workspace.wallpaperBackground != { }) ''desktop.writeConfig("${ - if cfg.workspace.wallpaperBackground.blur != null then "Blur" else "Color" + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + "Blur" + else + "Color" }", "${ - if cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur else cfg.workspace.wallpaperBackground.color @@ -557,9 +563,12 @@ in lib.optionalString (cfg.workspace.wallpaperBackground != null || cfg.workspace.wallpaperBackground != { }) ''desktop.writeConfig("${ - if cfg.workspace.wallpaperBackground.blur != null then "Blur" else "Color" + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + "Blur" + else + "Color" }", "${ - if cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur else cfg.workspace.wallpaperBackground.color From a07762d1531f24d5657d1ae4ead025298b6baa58 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Thu, 5 Dec 2024 11:25:56 -0300 Subject: [PATCH 5/8] test --- modules/workspace.nix | 45 +++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/modules/workspace.nix b/modules/workspace.nix index e28e69b5..5f51e6ed 100644 --- a/modules/workspace.nix +++ b/modules/workspace.nix @@ -461,18 +461,25 @@ in }");'' } ${ - lib.optionalString - (cfg.workspace.wallpaperBackground != null || cfg.workspace.wallpaperBackground != { }) + lib.optionalString (cfg.workspace.wallpaperBackground != null) ''desktop.writeConfig("${ if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then "Blur" - else + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null + then "Color" + else + throw "plasma-manager: wallpaperBackground is not null and has no option set" }", "${ if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur - else + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null + then cfg.workspace.wallpaperBackground.color + else + throw "plasma-manager: wallpaperBackground is not null and has no option set" }");'' } } @@ -500,18 +507,25 @@ in }");'' } ${ - lib.optionalString - (cfg.workspace.wallpaperBackground != null || cfg.workspace.wallpaperBackground != { }) + lib.optionalString (cfg.workspace.wallpaperBackground != null) ''desktop.writeConfig("${ if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then "Blur" - else + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null + then "Color" + else + throw "plasma-manager: wallpaperBackground is not null and has no option set" }", "${ if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur - else + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null + then cfg.workspace.wallpaperBackground.color + else + throw "plasma-manager: wallpaperBackground is not null and has no option set" }");'' } } @@ -560,18 +574,25 @@ in }");'' } ${ - lib.optionalString - (cfg.workspace.wallpaperBackground != null || cfg.workspace.wallpaperBackground != { }) + lib.optionalString (cfg.workspace.wallpaperBackground != null) ''desktop.writeConfig("${ if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then "Blur" - else + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null + then "Color" + else + throw "plasma-manager: wallpaperBackground is not null and has no option set" }", "${ if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur - else + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null + then cfg.workspace.wallpaperBackground.color + else + throw "plasma-manager: wallpaperBackground is not null and has no option set" }");'' } } From 7521d0453e0b41c99e450fdbb5d4c42f61bcc577 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Thu, 5 Dec 2024 11:43:36 -0300 Subject: [PATCH 6/8] finally a fix? --- modules/workspace.nix | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/modules/workspace.nix b/modules/workspace.nix index 5f51e6ed..d1127e0c 100644 --- a/modules/workspace.nix +++ b/modules/workspace.nix @@ -463,20 +463,16 @@ in ${ lib.optionalString (cfg.workspace.wallpaperBackground != null) ''desktop.writeConfig("${ - if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground.blur != null then "Blur" - else if - cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null - then + else if cfg.workspace.wallpaperBackground.blur != null then "Color" else throw "plasma-manager: wallpaperBackground is not null and has no option set" }", "${ - if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur - else if - cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null - then + else if cfg.workspace.wallpaperBackground.color != null then cfg.workspace.wallpaperBackground.color else throw "plasma-manager: wallpaperBackground is not null and has no option set" @@ -509,20 +505,16 @@ in ${ lib.optionalString (cfg.workspace.wallpaperBackground != null) ''desktop.writeConfig("${ - if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground.blur != null then "Blur" - else if - cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null - then + else if cfg.workspace.wallpaperBackground.blur != null then "Color" else throw "plasma-manager: wallpaperBackground is not null and has no option set" }", "${ - if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur - else if - cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null - then + else if cfg.workspace.wallpaperBackground.color != null then cfg.workspace.wallpaperBackground.color else throw "plasma-manager: wallpaperBackground is not null and has no option set" @@ -576,20 +568,16 @@ in ${ lib.optionalString (cfg.workspace.wallpaperBackground != null) ''desktop.writeConfig("${ - if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground.blur != null then "Blur" - else if - cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null - then + else if cfg.workspace.wallpaperBackground.blur != null then "Color" else throw "plasma-manager: wallpaperBackground is not null and has no option set" }", "${ - if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur - else if - cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null - then + else if cfg.workspace.wallpaperBackground.color != null then cfg.workspace.wallpaperBackground.color else throw "plasma-manager: wallpaperBackground is not null and has no option set" From c9fda32948a5f5391ceeff0597305033af0020ad Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Thu, 5 Dec 2024 11:46:39 -0300 Subject: [PATCH 7/8] Revert "finally a fix?" This reverts commit 7521d0453e0b41c99e450fdbb5d4c42f61bcc577. --- modules/workspace.nix | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/modules/workspace.nix b/modules/workspace.nix index d1127e0c..5f51e6ed 100644 --- a/modules/workspace.nix +++ b/modules/workspace.nix @@ -463,16 +463,20 @@ in ${ lib.optionalString (cfg.workspace.wallpaperBackground != null) ''desktop.writeConfig("${ - if cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then "Blur" - else if cfg.workspace.wallpaperBackground.blur != null then + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null + then "Color" else throw "plasma-manager: wallpaperBackground is not null and has no option set" }", "${ - if cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur - else if cfg.workspace.wallpaperBackground.color != null then + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null + then cfg.workspace.wallpaperBackground.color else throw "plasma-manager: wallpaperBackground is not null and has no option set" @@ -505,16 +509,20 @@ in ${ lib.optionalString (cfg.workspace.wallpaperBackground != null) ''desktop.writeConfig("${ - if cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then "Blur" - else if cfg.workspace.wallpaperBackground.blur != null then + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null + then "Color" else throw "plasma-manager: wallpaperBackground is not null and has no option set" }", "${ - if cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur - else if cfg.workspace.wallpaperBackground.color != null then + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null + then cfg.workspace.wallpaperBackground.color else throw "plasma-manager: wallpaperBackground is not null and has no option set" @@ -568,16 +576,20 @@ in ${ lib.optionalString (cfg.workspace.wallpaperBackground != null) ''desktop.writeConfig("${ - if cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then "Blur" - else if cfg.workspace.wallpaperBackground.blur != null then + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null + then "Color" else throw "plasma-manager: wallpaperBackground is not null and has no option set" }", "${ - if cfg.workspace.wallpaperBackground.blur != null then + if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then lib.boolToString cfg.workspace.wallpaperBackground.blur - else if cfg.workspace.wallpaperBackground.color != null then + else if + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null + then cfg.workspace.wallpaperBackground.color else throw "plasma-manager: wallpaperBackground is not null and has no option set" From e49433969cf98affffbe99ae9ca99b78291a5d14 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Thu, 5 Dec 2024 11:47:42 -0300 Subject: [PATCH 8/8] fix fix --- modules/workspace.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/workspace.nix b/modules/workspace.nix index 5f51e6ed..9dc6c90d 100644 --- a/modules/workspace.nix +++ b/modules/workspace.nix @@ -466,7 +466,7 @@ in if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then "Blur" else if - cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null then "Color" else @@ -512,7 +512,7 @@ in if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then "Blur" else if - cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null then "Color" else @@ -579,7 +579,7 @@ in if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then "Blur" else if - cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.blur != null + cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != null then "Color" else