configure sway

This commit is contained in:
Astreaprtcl 2025-12-19 01:54:22 +01:00
parent 61ecbd9721
commit f9138672e8
17 changed files with 322 additions and 25 deletions

View file

@ -0,0 +1,37 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) getExe getExe' mkOption types;
in
{
options.custom.backgroundDir = mkOption {
default = config.home.homeDirectory + "/Pictures/Backgrounds";
type = with 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 = "${getExe pkgs.bash} -c '${getExe pkgs.findutils} ${config.custom.backgroundDir} -type f | ${getExe' pkgs.coreutils "shuf"} -n 1 | ${getExe' pkgs.findutils "xargs"} ${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-random";
OnCalendar = "*-*-* *:00,30:00";
};
Install.WantedBy = [ "timers.target" ];
};
};
};
}