From 1f42d99ac520cd8dd6bda9437f0f2289c4748f4f Mon Sep 17 00:00:00 2001 From: "info@data-pro.nu" Date: Tue, 17 Mar 2026 18:36:22 +0000 Subject: [PATCH] new wallpaperthingie --- .../decorations/rotating_wallpaper.nix | 75 +++++++++---------- 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix b/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix index 7332a6397..f2c067107 100644 --- a/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix +++ b/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix @@ -1,57 +1,50 @@ -# file: wallpaper-copy.nix +# file: configuration.nix snippet { - lib, config, pkgs, + lib, flakeRoot, ... }: let - sourceDir = "${flakeRoot}/assets/hyprland/wallpaperstuff"; - - # Determine the username safely (fallback to "default" if home-manager is not present) - username = - if lib.attrExists "home" config && lib.attrExists "username" config.home then - config.home.username - else - "default"; - - # Determine target directory - targetDir = - if lib.attrExists "home" config then - "${config.home.homeDirectory}/Droidnix/wallpaperstuff" - else - "$HOME/Droidnix/wallpaperstuff"; - + # Path to wallpaperstuff folder in the flake + wallpaperDir = "${flakeRoot}/assets/hyprland/wallpaperstuff"; + wallpaperConf = "${wallpaperDir}/wallpaper.conf"; in { - options.wallpaper.enable = lib.mkEnableOption "Copy wallpaperstuff dir"; + # Make wpaperd available system-wide + environment.systemPackages = [ + pkgs.wpaperd + ]; - config = lib.mkIf config.wallpaper.enable { + # User-level systemd service for wpaperd + systemd.user.services.wpaperd = { + description = "wpaperd wallpaper daemon"; + after = [ "default.target" ]; - # System activation (runs on nixos-rebuild switch) - system.activationScripts.copyWallpapers = { - text = '' - echo "=== Copying wallpaperstuff (system activation) ===" - mkdir -p "${targetDir}" - cp -rT "${sourceDir}" "${targetDir}" - echo "Done." - ''; - deps = [ ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${wallpaperConf}"; + Restart = "on-failure"; + RestartSec = 1; }; - # Home Manager activation (runs when home-manager switch is executed) - home-manager.users.${username}.home.activation.copyWallpapers = - lib.mkIf (lib.attrExists "home" config) - { - description = "Copy wallpaperstuff to user home"; - script = '' - echo "=== Copying wallpaperstuff (home-manager activation) ===" - mkdir -p "${targetDir}" - cp -rT "${sourceDir}" "${targetDir}" - echo "Done." - ''; - }; + install = { + WantedBy = [ "default.target" ]; + }; + }; + + # Optional: ensure the directory exists + system.activationScripts.copyWallpaperConf = { + text = '' + echo "=== Ensuring wallpaper config exists ===" + mkdir -p "${wallpaperDir}/pictures" + if [ ! -f "${wallpaperConf}" ]; then + touch "${wallpaperConf}" + fi + echo "Done." + ''; + deps = [ ]; }; }