Skip to content

Commit

Permalink
nixos/sway: set default wallpaper
Browse files Browse the repository at this point in the history
  • Loading branch information
Synthetica9 committed May 14, 2021
1 parent 0380854 commit 45978fa
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions nixos/modules/programs/sway.nix
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ in {
'';
};

defaultWallpaper = mkOption {
type = with types; nullOr path;
default = pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath;

defaultText = literalExample ''
pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath;
'';

example = literalExample ''
null;
'';

description = ''
Default wallpaper. Set to `null` to not install a default wallpaper.
'';
};
};

config = mkIf cfg.enable {
Expand All @@ -126,6 +142,12 @@ in {
# user environments (e.g. required for screen sharing and Pinentry prompts):
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
'';
} // lib.optionalAttrs (cfg.defaultWallpaper != null) {
"sway/config.d/wallpaper.conf".source = pkgs.writeText "wallpaper.conf" ''
# Set the default wallpaper
output '*' background "/etc/sway/wallpaper" fill
'';
"sway/wallpaper".source = cfg.defaultWallpaper;
};
};
security.pam.services.swaylock = {};
Expand Down

0 comments on commit 45978fa

Please sign in to comment.