{ config, lib, pkgs, ... }: let cfg = config.services.wallpaperRotator; in { options.services.wallpaperRotator = { enable = lib.mkEnableOption "wallpaper rotation service using wpaperd"; user = lib.mkOption { type = lib.types.str; description = "Username for the wallpaper service"; }; wallpaperPath = lib.mkOption { type = lib.types.str; default = "/home/${cfg.user}/nixos/shared/modules/services/wallpapers"; description = "Path to the wallpaper directory"; }; duration = lib.mkOption { type = lib.types.str; default = "5m"; example = "30s"; description = "How long to display each wallpaper (e.g., 30s, 5m, 1h)"; }; sorting = lib.mkOption { type = lib.types.enum [ "random" "ascending" "descending" ]; default = "random"; description = "Order in which to display wallpapers"; }; mode = lib.mkOption { type = lib.types.enum [ "center" "fit" "fit-border-color" "stretch" "tile" ]; default = "center"; description = "How to display wallpapers when size differs from display resolution"; }; transition = { effect = lib.mkOption { type = lib.types.str; default = "fade"; example = "hexagonalize"; description = '' Transition effect name. Available effects include: fade, hexagonalize, simple-zoom, swirl, circle, wipe, slide, etc. See wpaperd documentation for full list. ''; }; duration = lib.mkOption { type = lib.types.int; default = 300; example = 2000; description = "Transition duration in milliseconds"; }; }; queueSize = lib.mkOption { type = lib.types.int; default = 10; description = "Size of wallpaper history queue for random mode"; }; initialTransition = lib.mkOption { type = lib.types.bool; default = true; description = "Enable transition effect at wpaperd startup"; }; }; config = lib.mkIf cfg.enable { home-manager.users.${cfg.user} = { services.wpaperd = { enable = true; settings = { # Default configuration for all displays default = { path = cfg.wallpaperPath; duration = cfg.duration; sorting = cfg.sorting; mode = cfg.mode; transition-time = cfg.transition.duration; queue-size = cfg.queueSize; initial-transition = cfg.initialTransition; }; # Apply transition effect "default.transition.${cfg.transition.effect}" = {}; }; }; # Add wpaperd CLI tool to user packages for manual control home.packages = with pkgs; [ wpaperd ]; }; }; }