config/modules/home/services/wallpaper/default.nix
2025-05-28 19:10:50 -04:00

32 lines
717 B
Nix

{
lib,
config,
pkgs,
...
}:
with lib;
with lib.custom; let
cfg = config.services.wallpaper;
mkService = recursiveUpdate {
Unit.PartOf = ["graphical-session.target"];
Unit.After = ["graphical-session.target"];
Install.WantedBy = ["graphical-session.target"];
};
in {
options.services.wallpaper = with types; {
enable = mkBoolOpt false "Enable MPD (Music Player Daemon)";
};
config = mkIf (cfg.enable && !pkgs.stdenv.isDarwin) {
systemd.user.services = {
swaybg = mkService {
Unit.Description = "Wallpaper Chooser";
Service = {
ExecStart = "${getExe pkgs.swaybg} -i ${wallpaper}";
Restart = "always";
};
};
};
};
}