diff options
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 | } | ||
