From 3b4f19958b1a6e302c1378d4707c2a1c3688cde4 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Fri, 6 Dec 2024 06:52:59 +0000 Subject: [PATCH] Add script to call swww based on time of day --- system/home/swww/default.nix | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/system/home/swww/default.nix b/system/home/swww/default.nix index 70432fcb..9a2555a1 100644 --- a/system/home/swww/default.nix +++ b/system/home/swww/default.nix @@ -1,4 +1,30 @@ { 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 + ]; }