Skip to content

Allow setting different wallpapers for different screens #470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 37 additions & 27 deletions modules/workspace.nix
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ in
};

wallpaper = lib.mkOption {
type = with lib.types; nullOr path;
type = with lib.types; nullOr (either path (listOf path));
default = null;
example = lib.literalExpression ''"''${pkgs.kdePackages.plasma-workspace-wallpapers}/share/wallpapers/Kay/contents/images/1080x1920.png"'';
description = ''
Expand Down Expand Up @@ -453,34 +453,44 @@ in
for (const desktop of allDesktops) {
desktop.wallpaperPlugin = "org.kde.image";
desktop.currentConfigGroup = ["Wallpaper", "org.kde.image", "General"];
desktop.writeConfig("Image", "file://${toString cfg.workspace.wallpaper}");
${
lib.optionalString (cfg.workspace.wallpaperFillMode != null)
''desktop.writeConfig("FillMode", "${
toString wallpaperFillModeTypes.${cfg.workspace.wallpaperFillMode}
}");''
if (builtins.typeOf cfg.workspace.wallpaper) == "list" then
''
let images = [
${
builtins.concatStringsSep "\n," (map (
wallpaper: ''"file://${toString wallpaper}"''
) cfg.workspace.wallpaper)
}
];
let image = images[desktop.screen];''
else
''let image = "file://${toString cfg.workspace.wallpaper}""''
}
${
lib.optionalString (cfg.workspace.wallpaperBackground != null)
''desktop.writeConfig("${
if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then
"Blur"
else if
cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != 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 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"
}");''
if (image) {
desktop.writeConfig("Image", image);
${
lib.optionalString (cfg.workspace.wallpaperBackground != null)
''desktop.writeConfig("${
if cfg.workspace.wallpaperBackground ? blur && cfg.workspace.wallpaperBackground.blur != null then
"Blur"
else if
cfg.workspace.wallpaperBackground ? color && cfg.workspace.wallpaperBackground.color != 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 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"
}");''
}
}
}
'';
Expand Down