From 45978fac994788c1e7fb8f7409f27a6102b9cf0f Mon Sep 17 00:00:00 2001 From: Patrick Hilhorst Date: Fri, 14 May 2021 15:40:50 +0200 Subject: [PATCH] nixos/sway: set default wallpaper --- nixos/modules/programs/sway.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/nixos/modules/programs/sway.nix b/nixos/modules/programs/sway.nix index 2b69851b340b4..95874d276e37d 100644 --- a/nixos/modules/programs/sway.nix +++ b/nixos/modules/programs/sway.nix @@ -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 { @@ -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 = {};