diff --git a/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix b/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix index e717fb4b6..7245ef514 100644 --- a/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix +++ b/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix @@ -7,43 +7,48 @@ }: let - # Path to wallpaperstuff folder in the flake - wallpaperDir = "${flakeRoot}/assets/hyprland/wallpaperstuff"; - wallpaperConf = "${wallpaperDir}/wallpaper.conf"; + # Source wallpaperstuff in the flake + wallpaperSource = "${flakeRoot}/assets/hyprland/wallpaperstuff"; + + # Target in the user home + wallpaperTarget = "$HOME/.config/wpaperd"; + + # Config file inside the flake + wallpaperConf = "${flakeRoot}/assets/hyprland/wallpaperstuff/wallpaper.conf"; in { - # Make wpaperd available system-wide - environment.systemPackages = [ - pkgs.wpaperd - ]; + # Install the wpaperd package system-wide + environment.systemPackages = with pkgs; [ wpaperd ]; - # User-level systemd service for wpaperd - systemd.user.services.wpaperd = { - description = "wpaperd wallpaper daemon"; - after = [ "default.target" ]; - enable = true; # <-- Must be set for user services - - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${wallpaperConf}"; - Restart = "on-failure"; - RestartSec = 1; - }; - - # Optional: make it start on login (default.target) - wantedBy = [ "default.target" ]; - }; - - # Optional: ensure the directory exists at activation - system.activationScripts.copyWallpaperConf = { + # Activation script: copy wallpapers & config to user home + system.activationScripts.copyWpaperdConfig = { text = '' - echo "=== Ensuring wallpaper config exists ===" - mkdir -p "${wallpaperDir}/pictures" - if [ ! -f "${wallpaperConf}" ]; then - touch "${wallpaperConf}" - fi + echo "=== Copying wpaperd config to $HOME/.config/wpaperd ===" + mkdir -p "${wallpaperTarget}" + cp -rT "${wallpaperSource}" "${wallpaperTarget}" echo "Done." ''; deps = [ ]; }; + + # Enable linger so user services can run outside login + systemd.enableUserServices = true; + systemd.user.enableLinger = true; + + # User systemd service + systemd.user.services.wpaperd = { + description = "wpaperd wallpaper daemon"; + after = [ "default.target" ]; + + serviceConfig = { + Type = "simple"; + # Use bash -c to expand HOME properly + ExecStart = "bash -c '${pkgs.wpaperd}/bin/wpaperd --config ${wallpaperTarget}/wallpaper.conf'"; + Restart = "on-failure"; + RestartSec = 1; + }; + + # Enable the service by default + wantedBy = [ "default.target" ]; + }; }