Add script to call swww based on time of day

This commit is contained in:
Evie Litherland-Smith 2024-12-06 06:52:59 +00:00
parent 780838e8a0
commit 3b4f19958b

View file

@ -1,4 +1,30 @@
{ pkgs, ... }: { 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" ''
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
{ {
home.packages = with pkgs; [ swww ]; home.packages = [
pkgs.swww
dynamicWallpaper
];
} }