try setting wallpapers once more

This commit is contained in:
Remy Moll 2025-03-11 14:59:46 +01:00
parent f6f3a19d18
commit 8eed29719d

View File

@ -4,23 +4,21 @@
...
}:
with lib; let
# wallpapers = builtins.readDir ../../../wallpapers;
# load the wallpapers from the wallpapers directory
wallpapers = builtins.readDir ../../../wallpapers;
# wallpaperBashArray = "(\"${strings.concatStrings (strings.intersperse "\" \"" (map (wallpaper: ../../../wallpapers + "/" + wallpaper) (attrNames wallpapers)))}\")";
# wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" ''
# wallpapers=${wallpaperBashArray}
# rand=$[$RANDOM % ''${#wallpapers[@]}]
# wallpaper=''${wallpapers[$rand]}
# script that picks a random wallpaper from the array and sets it as the desktop background
monitor = ""; # leave empty to set the wallpaper on all monitors
randomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" ''
wallpaper=$(shuf -n 1 -e ${wallpapers[@]})
hyprctl hyprpaper unload all
hyprctl hyprpaper preload $wallpaper
hyprctl hyprpaper wallpaper "${monitor},${wallpaper}"
'';
# monitor=(`hyprctl monitors | grep Monitor | awk '{print $2}'`)
# hyprctl hyprpaper unload all
# hyprctl hyprpaper preload $wallpaper
# for m in ''${monitor[@]}; do
# hyprctl hyprpaper wallpaper "$m,$wallpaper"
# done
# '';
in {
# home.packages = [wallpaperRandomizer];
home.packages = [wallpaperRandomizer];
@ -30,39 +28,32 @@ in {
settings = {
ipc = "off";
splash = false;
preload = [
"${../../../wallpapers/magicpattern-87PP9Zd7MNo-unsplash.jpg}"
];
wallpaper = [
",${../../../wallpapers/magicpattern-87PP9Zd7MNo-unsplash.jpg}"
];
};
};
# systemd.user = {
# services.wallpaperRandomizer = {
# Install = {WantedBy = ["graphical-session.target"];};
systemd.user = {
services.wallpaperRandomizer = {
Install = {WantedBy = ["graphical-session.target"];};
# Unit = {
# Description = "Set random desktop background using hyprpaper";
# After = ["graphical-session-pre.target"];
# PartOf = ["graphical-session.target"];
# };
Unit = {
Description = "Set random desktop background using hyprpaper";
After = ["graphical-session-pre.target"];
PartOf = ["graphical-session.target"];
};
# Service = {
# Type = "oneshot";
# ExecStart = "${wallpaperRandomizer}/bin/wallpaperRandomizer";
# IOSchedulingClass = "idle";
# };
# };
Service = {
Type = "oneshot";
ExecStart = "${wallpaperRandomizer}/bin/wallpaperRandomizer";
IOSchedulingClass = "idle";
};
};
# timers.wallpaperRandomizer = {
# Unit = {Description = "Set random desktop background using hyprpaper on an interval";};
timers.wallpaperRandomizer = {
Unit = {Description = "Set random desktop background using hyprpaper on an interval";};
# Timer = {OnUnitActiveSec = "6h";};
Timer = {OnUnitActiveSec = "6h";};
# Install = {WantedBy = ["timers.target"];};
# };
# };
Install = {WantedBy = ["timers.target"];};
};
};
}