Skip to content

Commit

Permalink
wallpaper background
Browse files Browse the repository at this point in the history
  • Loading branch information
HeitorAugustoLN committed Nov 30, 2024
1 parent 02350cd commit 5647407
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 9 deletions.
2 changes: 1 addition & 1 deletion modules/apps/okular.nix
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ with lib.types;
# Change to black & white colors (see options below)
"BlackWhite"
# Invert lightness but leave hue and saturation
"InvertLightness"
"InvertLightness"
# Like InvertLightness, but slightly more contrast
"InvertLumaSymmetric"
# Like InvertLightness, but much more contrast
Expand Down
7 changes: 5 additions & 2 deletions modules/kwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ let
names:
builtins.listToAttrs (lib.imap1 (i: v: (lib.nameValuePair "Name_${builtins.toString i}" v)) names);


virtualDesktopIdAttrs =
number:
builtins.listToAttrs (map (i: (lib.nameValuePair "Id_${builtins.toString i}" "Desktop_${builtins.toString i}")) (lib.range 1 number));
builtins.listToAttrs (
map (i: (lib.nameValuePair "Id_${builtins.toString i}" "Desktop_${builtins.toString i}")) (
lib.range 1 number
)
);

capitalizeWord =
word:
Expand Down
4 changes: 1 addition & 3 deletions modules/widgets/icon-tasks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,7 @@ in
...
}:
{
name = if iconsOnly
then "org.kde.plasma.icontasks"
else "org.kde.plasma.taskmanager";
name = if iconsOnly then "org.kde.plasma.icontasks" else "org.kde.plasma.taskmanager";
config = lib.recursiveUpdate {
General = lib.filterAttrs (_: v: v != null) {
launchers = launchers;
Expand Down
4 changes: 1 addition & 3 deletions modules/widgets/plasmusic-toolbar.nix
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,7 @@ in
if source == null then
{ }
else if source == "auto" then
{
choosePlayerAutomatically = true;
}
{ choosePlayerAutomatically = true; }
else
{
choosePlayerAutomatically = false;
Expand Down
66 changes: 66 additions & 0 deletions modules/workspace.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ let
};
};

wallpaperBackgroundType = lib.types.submodule (
{ config, ... }:
{
options = {
color = lib.mkOption {
type = with lib.types; nullOr str;
default = null;
example = "219,99,99";
description = "Background color to use";
};
blur = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to blur the background";
};
};
}
);

anyThemeSet = (
cfg.workspace.theme != null
|| cfg.workspace.colorScheme != null
Expand Down Expand Up @@ -191,6 +211,15 @@ in
'';
};

wallpaperBackground = lib.mkOption {
type = lib.types.nullOr wallpaperBackgroundType;
default = null;
example = {
blur = true;
};
description = "How to handle wallpaper background when there is empty space.";
};

soundTheme = lib.mkOption {
type = with lib.types; nullOr str;
default = null;
Expand Down Expand Up @@ -282,6 +311,15 @@ in
plasma.workspace.windowDecorations.theme or none.
'';
}
{
assertion = (
cfg.workspace.wallpaperBackground == null
|| (
cfg.workspace.wallpaperBackground.blur == null || cfg.workspace.wallpaperBackground.color == null
)
);
message = "programs.plasma.wallpaperBackground can only have a color or be blurred.";
}
];
warnings = (
if
Expand Down Expand Up @@ -448,6 +486,20 @@ in
toString wallpaperFillModeTypes.${cfg.workspace.wallpaperFillMode}
}");''
}
${
lib.optionalString (cfg.workspace.wallpaperBackground != null)
''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 Expand Up @@ -493,6 +545,20 @@ in
toString wallpaperFillModeTypes.${cfg.workspace.wallpaperFillMode}
}");''
}
${
lib.optionalString (cfg.workspace.wallpaperBackground != null)
''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 5647407

Please sign in to comment.