diff --git a/system/home/hyprland.nix b/system/home/hyprland.nix index a17dbffd..002845c9 100644 --- a/system/home/hyprland.nix +++ b/system/home/hyprland.nix @@ -13,6 +13,7 @@ ./mako.nix ./avizo.nix ./wlogout.nix + ./swww.nix ]; home.packages = [ (pkgs.writeShellScriptBin "protonmail-setup-bridge" '' @@ -22,7 +23,6 @@ '') ]; services = { - hyprpaper.enable = true; kanshi.systemdTarget = "hyprland-session.target"; gpg-agent.pinentryPackage = pkgs.pinentry-gnome3; hypridle = { @@ -147,6 +147,7 @@ "${config.wayland.windowManager.hyprland.finalPackage}/bin/hyprctl setcursor ${config.gtk.cursorTheme.name} ${toString config.gtk.cursorTheme.size}" "${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1" "PASSWORD_STORE_DIR=/dev/null ${pkgs.protonmail-bridge}/bin/protonmail-bridge -n" + "${pkgs.swww}/bin/swww-daemon" "sleep 5; ${pkgs.dex}/bin/dex -a" ]; gestures.workspace_swipe = true; @@ -415,9 +416,5 @@ ]; }; }; - xdg.configFile."hypr/hyprpaper.conf".text = '' - preload = ${config.stylix.image} - wallpaper = ,${config.stylix.image} - ''; } diff --git a/system/home/swww.nix b/system/home/swww.nix new file mode 100644 index 00000000..83956002 --- /dev/null +++ b/system/home/swww.nix @@ -0,0 +1,51 @@ +{ 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 +{ + systemd.user = { + timers.dynamic-wallpaper = { + Install.WantedBy = [ "timers.target" ]; + Timer = { + OnCalendar = "*:0"; + Unit = "dynamic-wallpaper.service"; + }; + }; + services.dynamic-wallpaper = { + Unit = { + Description = "Change wallpaper based on time of day"; + Wants = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + Service = { + Type = "oneshot"; + ExecStart = "${dynamicWallpaper}/bin/dynamic-wallpaper"; + }; + }; + }; + home.packages = [ + pkgs.swww + dynamicWallpaper + ]; +} diff --git a/system/home/swww/default.nix b/system/home/swww/default.nix deleted file mode 100644 index 9a2555a1..00000000 --- a/system/home/swww/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ 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 = [ - pkgs.swww - dynamicWallpaper - ]; -} diff --git a/system/home/swww/swww_init_according_to_time_of_day.sh b/system/home/swww/swww_init_according_to_time_of_day.sh deleted file mode 100644 index 56157c0a..00000000 --- a/system/home/swww/swww_init_according_to_time_of_day.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -# This allows you to control which image to init the daemon with according -# to the time of day. You may change the match cases as you see fit. -# This currently only takes hours into account, but it should be easy to -# modify to also use minutes, or days of the week, if you want. -# -# Use it simply by calling this script instead of swww-daemon - -case $(date +%H) in - 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07) # First 8 hours of the day - # Uncomment below to setup the image you wish to display as your - # wallpaper if you run this script during the first 8 hours of the - # day - - # swww-daemon && swww img path/to/img - ;; - 08 | 09 | 10 | 11 | 12 | 13 | 14 | 15) # Middle 8 hours of the day - # Same as above, but for the middle 8 hours of the day - - # swww-daemon && swww img path/to/img - ;; - 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23) # Final 8 hours of the day - # Same as above, but for the final 8 hours of the day - - # swww-daemon && swww img path/to/img - ;; -esac