configuration.nix/home/wm/addon/wallpaper.nix

66 lines
1.6 KiB
Nix
Raw Normal View History

2024-04-21 23:00:50 +05:30
{ config, pkgs, ... }:
let
pictures = "${config.xdg.userDirs.pictures}";
change-wallpaper = "${pkgs.scripts}/bin/chpaper ${pictures}/Wallpapers";
2024-04-28 13:29:47 +05:30
wallpaper-downloader = "${pkgs.scripts}/bin/wallhaven ${pictures}/Wallpapers";
2024-04-21 23:00:50 +05:30
in
{
2024-04-21 23:45:36 +05:30
systemd.user = {
2024-04-28 13:29:47 +05:30
services = {
wallhaven = {
Unit = {
Description = "Wallpaper Downloader";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session-pre.target" ];
2024-04-28 13:29:47 +05:30
};
Service = {
Type = "oneshot";
ExecStart = "${wallpaper-downloader}";
};
2024-04-21 23:45:36 +05:30
};
2024-04-28 13:29:47 +05:30
wallpaper = {
Unit = {
Description = "Change Wallpaper";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session-pre.target" ];
Wants = "swww-daemon.service";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
Type = "oneshot";
ExecStart = "${change-wallpaper}";
};
2024-04-21 23:45:36 +05:30
};
2024-04-21 23:00:50 +05:30
};
2024-04-28 13:29:47 +05:30
timers = {
wallhaven = {
Unit = {
Description = "Wallpaper Downloader";
};
Install = {
WantedBy = [ "default.target" ];
};
Timer = {
OnCalendar = "Fri";
Persistent = true;
2024-04-28 13:29:47 +05:30
};
};
2024-04-28 13:29:47 +05:30
wallpaper = {
Unit = {
Description = "Change Wallpaper";
};
Install = {
WantedBy = [ "default.target" ];
};
Timer = {
OnStartupSec = "10min";
OnUnitActiveSec = "10min";
};
2024-04-21 23:45:36 +05:30
};
2024-04-21 23:00:50 +05:30
};
};
}