nixos/system/home/swww/dynamic-wallpaper.nix
Evie Litherland-Smith e0dea93832 Split swww files into daemon and dynamic wallpaper
Change wallpaper to the Citadel, use an animated version on Vanguard
only

Drop nix-ts-mode for Emacs (use regular nix-mode)
2025-01-02 16:14:26 +00:00

46 lines
1.3 KiB
Nix

{ pkgs, ... }:
let
swwwMorning = "${pkgs.swww}/bin/swww img ${../wallpapers/tropic_island_morning.jpg}";
swwwDay = "${pkgs.swww}/bin/swww img ${../wallpapers/tropic_island_day.jpg}";
swwwEvening = "${pkgs.swww}/bin/swww img ${../wallpapers/tropic_island_evening.jpg}";
swwwNight = "${pkgs.swww}/bin/swww img ${../wallpapers/tropic_island_night.jpg}";
dynamicWallpaper = pkgs.writeShellScriptBin "dynamic-wallpaper" ''
swww query || exit 1 # Check SWWW daemon is actually running
case $(date +%H) in
06 | 07 | 08) # Morning
${swwwMorning}
;;
09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17) # Day
${swwwDay}
;;
18 | 19 | 20) # Evening
${swwwEvening}
;;
21 | 22 | 23 | 00 | 01 | 02 | 03 | 04 | 05) # Night
${swwwNight}
;;
esac
'';
in
{
imports = [ ./default.nix ];
systemd.user = {
services.dynamic-wallpaper = {
Unit = {
Description = "Change wallpaper based on time of day";
Wants = [ "swww-daemon.service" ];
After = [ "swww-daemon.service" ];
};
Service = {
Type = "oneshot";
ExecStart = "${dynamicWallpaper}/bin/dynamic-wallpaper";
};
};
timers.dynamic-wallpaper.Timer = {
OnCalendar = "*:0";
Unit = "dynamic-wallpaper.service";
};
};
}