From afb474061df5e2344d4afda0ccedc048f8754ed2 Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Sat, 27 Jun 2026 01:41:02 -0400 Subject: "official" way to do the wallpapers --- modules/darwin/random-wallpaper/module.nix | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 modules/darwin/random-wallpaper/module.nix (limited to 'modules/darwin/random-wallpaper/module.nix') diff --git a/modules/darwin/random-wallpaper/module.nix b/modules/darwin/random-wallpaper/module.nix new file mode 100644 index 0000000..b20ce88 --- /dev/null +++ b/modules/darwin/random-wallpaper/module.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.local.randomWallpaper; + wallpaper-agent-src = ./wallpaper-daemon.swift; +in +{ + options.local.randomWallpaper = { + enable = lib.mkEnableOption "Random Rotating Wallpaper"; + directory = lib.mkOption { + type = lib.types.str; + description = "Folder containing images"; + }; + interval = lib.mkOption { + type = lib.types.int; + default = 1800; + description = "Seconds between wallpaper changes"; + }; + }; + + config = lib.mkIf cfg.enable { + launchd.user.agents.random-wallpaper.serviceConfig = { + Label = "org.rschanz.wallpaperDaemon"; + ProgramArguments = [ "/usr/bin/swift" "${wallpaper-agent-src}" "${cfg.directory}" "${builtins.toString cfg.interval}" ]; + RunAtLoad = true; + KeepAlive = true; + ProcessType = "Background"; + }; + }; +} -- cgit v1.3