Skip to content

Commit

Permalink
feat(workspace): add wallpaperBackground support for wallpaper
Browse files Browse the repository at this point in the history
  • Loading branch information
HeitorAugustoLN committed Nov 30, 2024
1 parent 88ca377 commit cb982e9
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions modules/workspace.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cb982e9

Please sign in to comment.