Skip to content

Commit

Permalink
modules: optional image
Browse files Browse the repository at this point in the history
  • Loading branch information
Flameopathic committed Jan 1, 2025
1 parent f48cab3 commit 63b1088
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions modules/feh/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
lib.mkIf (
config.stylix.enable
&& config.stylix.targets.feh.enable
&& config.stylix.image != null
&& (
with config.xsession.windowManager;
bspwm.enable
Expand Down
1 change: 1 addition & 0 deletions modules/feh/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
lib.mkIf (
config.stylix.enable
&& config.stylix.targets.feh.enable
&& config.stylix.image != null
&& (
with config.services.xserver.windowManager;
xmonad.enable
Expand Down
4 changes: 2 additions & 2 deletions modules/gnome/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ in {
then "centered"
# Seemingly no tile support... :(
else "zoom";
picture-uri = "file://${config.stylix.image}";
picture-uri-dark = "file://${config.stylix.image}";
picture-uri = lib.mkIf config.stylix.image != null "file://${config.stylix.image}";
picture-uri-dark = lib.mkIf config.stylix.image != null "file://${config.stylix.image}";
};

"org/gnome/desktop/interface" = {
Expand Down
2 changes: 1 addition & 1 deletion modules/grub/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ in {
mkdir $out
cp $themeTxtPath $out/theme.txt
${if config.stylix.targets.grub.useImage
${if config.stylix.targets.grub.useImage && config.stylix.image != null
# Make sure the background image is .png by asking to convert it
then
"${pkgs.imagemagick}/bin/convert ${config.stylix.image} png32:$out/background.png"
Expand Down
5 changes: 4 additions & 1 deletion modules/hyprlock/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ with config.lib.stylix;

config = lib.mkIf (config.stylix.enable && config.stylix.targets.hyprlock.enable) {
programs.hyprlock.settings = {
background.path = "${config.stylix.image}";
background = {
path = lib.mkIf config.stylix.image != null config.stylix.image;
color = "rgb(${base00})";
};
input-field = with colors; {
outer_color = "rgb(${base03})";
inner_color = "rgb(${base00})";
Expand Down
2 changes: 1 addition & 1 deletion modules/hyprpaper/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

config =
lib.mkIf
(config.stylix.enable && config.stylix.targets.hyprpaper.enable)
(config.stylix.enable && config.stylix.targets.hyprpaper.enable && config.stylix.image != null)
{
services.hyprpaper.settings = {
preload = [ "${config.stylix.image}" ];
Expand Down
2 changes: 1 addition & 1 deletion modules/lightdm/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
config.lib.stylix.mkEnableTarget "LightDM" true;

config.services.xserver.displayManager.lightdm.background =
lib.mkIf (config.stylix.enable && config.stylix.targets.lightdm.enable) config.stylix.image;
lib.mkIf (config.stylix.enable && config.stylix.targets.lightdm.enable && config.stylix.image != null) config.stylix.image;
}
2 changes: 1 addition & 1 deletion modules/regreet/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(config.stylix.enable && config.stylix.targets.regreet.enable && pkgs.stdenv.hostPlatform.isLinux)
{
programs.regreet = {
settings.background = {
settings.background = lib.mkIf config.stylix.image != null {
path = config.stylix.image;
fit = let
inherit (config.stylix) imageScalingMode;
Expand Down
2 changes: 1 addition & 1 deletion modules/sway/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ in {
};
};

output."*".bg = "${config.stylix.image} ${config.stylix.imageScalingMode}";
output."*".bg = lib.mkIf config.stylix.image != null "${config.stylix.image} ${config.stylix.imageScalingMode}";
seat."*".xcursor_theme = ''"${config.stylix.cursor.name}" ${toString config.stylix.cursor.size}'';
};
})
Expand Down
2 changes: 1 addition & 1 deletion modules/swaylock/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ in {
text-caps-lock-color = text;
text-ver-color = text;
text-wrong-color = text;
} // lib.optionalAttrs config.stylix.targets.swaylock.useImage {
} // lib.optionalAttrs config.stylix.targets.swaylock.useImage && config.stylix.image != null {
image = "${config.stylix.image}";
};
};
Expand Down
2 changes: 1 addition & 1 deletion modules/wpaperd/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
options.stylix.targets.wpaperd.enable = config.lib.stylix.mkEnableTarget "wpaperd" true;

config = lib.mkIf (config.stylix.enable && config.stylix.targets.wpaperd.enable) {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.wpaperd.enable && config.stylix.image != null ) {
programs.wpaperd.settings.any = {
path = "${config.stylix.image}";
mode = let
Expand Down

0 comments on commit 63b1088

Please sign in to comment.