restructure and further configure sway

This commit is contained in:
Astreaprtcl 2025-12-21 00:44:47 +01:00
parent f9138672e8
commit 8f5c2ff8f6
25 changed files with 476 additions and 256 deletions

42
users/default/swww.nix Normal file
View file

@ -0,0 +1,42 @@
{
config,
lib,
pkgs,
...
}:
{
options.services.swww-randomize = {
enable = lib.mkEnableOption "enable the randomization swww service";
backgroundDir = lib.mkOption {
default = config.home.homeDirectory + "/Pictures/Backgrounds";
description = "directory with images to use for the background";
type = with lib.types; uniq str;
};
};
config = {
services.swww.enable = true;
systemd.user = {
services.swww-randomize = {
Unit = {
Description = "randomly change the swww background image";
Requires = "swww.service";
};
Service = {
Type = "oneshot";
ExecStart = "${lib.getExe pkgs.bash} -c '${lib.getExe pkgs.findutils} ${config.services.swww-randomize.backgroundDir} -type f | ${lib.getExe' pkgs.coreutils "shuf"} -n 1 | ${lib.getExe' pkgs.findutils "xargs"} ${lib.getExe pkgs.swww} img --transition-step 16'";
};
Install.WantedBy = [ "default.target" ];
};
timers.swww-randomize = {
Unit.Description = "randomly changes the swww background image";
Timer = {
Unit = "swww-randomize";
OnCalendar = "*-*-* *:00,30:00";
};
Install.WantedBy = [ "timers.target" ];
};
};
};
}