diff options
| author | Ryan Schanzenbacher <ryan@rschanz.org> | 2026-06-27 01:41:02 -0400 |
|---|---|---|
| committer | Ryan Schanzenbacher <ryan@rschanz.org> | 2026-06-27 01:41:02 -0400 |
| commit | afb474061df5e2344d4afda0ccedc048f8754ed2 (patch) | |
| tree | 6f663c47703e608319b61ea00de1a484a09624c1 /modules/darwin/random-wallpaper/module.nix | |
| parent | 94ddd4b8cf401ef424328478bffaa9cee794d07e (diff) | |
Diffstat (limited to 'modules/darwin/random-wallpaper/module.nix')
| -rw-r--r-- | modules/darwin/random-wallpaper/module.nix | 29 |
1 files changed, 29 insertions, 0 deletions
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 @@ | |||
| 1 | { config, lib, pkgs, ... }: | ||
| 2 | let | ||
| 3 | cfg = config.local.randomWallpaper; | ||
| 4 | wallpaper-agent-src = ./wallpaper-daemon.swift; | ||
| 5 | in | ||
| 6 | { | ||
| 7 | options.local.randomWallpaper = { | ||
| 8 | enable = lib.mkEnableOption "Random Rotating Wallpaper"; | ||
| 9 | directory = lib.mkOption { | ||
| 10 | type = lib.types.str; | ||
| 11 | description = "Folder containing images"; | ||
| 12 | }; | ||
| 13 | interval = lib.mkOption { | ||
| 14 | type = lib.types.int; | ||
| 15 | default = 1800; | ||
| 16 | description = "Seconds between wallpaper changes"; | ||
| 17 | }; | ||
| 18 | }; | ||
| 19 | |||
| 20 | config = lib.mkIf cfg.enable { | ||
| 21 | launchd.user.agents.random-wallpaper.serviceConfig = { | ||
| 22 | Label = "org.rschanz.wallpaperDaemon"; | ||
| 23 | ProgramArguments = [ "/usr/bin/swift" "${wallpaper-agent-src}" "${cfg.directory}" "${builtins.toString cfg.interval}" ]; | ||
| 24 | RunAtLoad = true; | ||
| 25 | KeepAlive = true; | ||
| 26 | ProcessType = "Background"; | ||
| 27 | }; | ||
| 28 | }; | ||
| 29 | } | ||
