diff --git a/Droidnix/README.org b/Droidnix/README.org index bddbc97af..cd5951f86 100644 --- a/Droidnix/README.org +++ b/Droidnix/README.org @@ -780,37 +780,50 @@ rotating_wallpaper.nix installs wpaperd and deploys your wallpaper files from th You can edit assets/copy_2_root/wallpaperstuff/wallpaper.conf to change settings Finally, it creates a systemd user service (wpaperd.service) that automatically starts wpaperd at login and keeps it running, using your override config so wallpapers rotate according to your settings. #+BEGIN_SRC nix :tangle generated/hyprland/decorations/rotating_wallpaper.nix :noweb tangle :mkdirp yes :eval never-html -{ lib, config, pkgs, flakeRoot, ... }: +{ + config, + pkgs, + lib, + flakeRoot, + ... +}: let - # Define source and destination paths - source_path = "${flakeRoot}/assets/hyprland/wallpaperstuff"; - destination_path = "${config.home.homeDirectory}/Droidnix/wallpaperstuff"; - script_path = "${flakeRoot}/assets/hyprland/scripts/copy_wallpaperstuff.sh"; - wallpaper_conf = "${flakeRoot}/assets/hyprland/wallpaperstuff/wallpaper.conf"; -in { - options = { - wallpaper.enable = lib.mkEnableOption "Wallpaper setup"; + wallpaperSource = "${flakeRoot}/assets/hyprland/wallpaperstuff"; + wallpaperTarget = "$HOME/.config/wpaperd"; +in +{ + # Install wpaperd system-wide + environment.systemPackages = with pkgs; [ wpaperd ]; + + # Activation script: copy wallpapers & config to ~/.config/wpaperd + system.activationScripts.copyWpaperdConfig = { + text = '' + echo "=== Copying wpaperd config to $HOME/.config/wpaperd ===" + mkdir -p "${wallpaperTarget}" + cp -rT "${wallpaperSource}" "${wallpaperTarget}" + echo "Done." + ''; + deps = [ ]; }; - config = lib.mkIf config.wallpaper.enable { - # Ensure the script is executable - home-manager.users.${config.home.username}.home.file."${script_path}".executable = true; + # User systemd service (runs on login) + systemd.user.services.wpaperd = { + description = "wpaperd wallpaper daemon"; + after = [ "default.target" ]; - # Run the script on activation - home-manager.users.${config.home.username}.home.activation.copy-wallpapers.script = '' - echo "=== Activation Script Running ===" - cat "${script_path}" - "${script_path}" - ''; + serviceConfig = { + Type = "simple"; + ExecStart = "bash -c '${pkgs.wpaperd}/bin/wpaperd --config ${wallpaperTarget}/wallpaper.conf'"; + Restart = "on-failure"; + RestartSec = 1; + }; - # Install wpaperd - home-manager.users.${config.home.username}.home.packages = [ pkgs.wpaperd ]; - - # Configure wpaperd - home-manager.users.${config.home.username}.home.file."${config.home.homeDirectory}/.config/wpaperd/config.toml".text = builtins.readFile wallpaper_conf; + wantedBy = [ "default.target" ]; + enable = true; }; } + #+END_SRC ** =generated/hyprland/notifications/top.nix=