From f13c946181730f98e1a5cd09714100490207b250 Mon Sep 17 00:00:00 2001 From: Ed Roberts Rayne <96839304+edrobertsrayne@users.noreply.github.com> Date: Mon, 17 Jun 2024 15:30:35 +0100 Subject: [PATCH] hyprpaper: init (#377) Initialize the 'hyprpaper' module. In the future, it might be possible to 'unload' the one-off wallpaper to reduce the running memory usage [1]: > Preload does exactly what it says. It loads the entire wallpaper into > memory. This can result in around 8 - 20MB of mem usage. It is not > recommended to preload every wallpaper you have, as it will be a) > taking a couple seconds at the beginning to load and b) take 100s of > MBs of disk and RAM usage. > > Preload is meant only for situations in which you want a wallpaper to > switch INSTANTLY when you issue a wallpaper keyword (e.g. wallpaper > per workspace) > > In any and all cases when you don't mind waiting 300ms for the > wallpaper to change, consider making a script that: > - preloads the new wallpaper > - sets the new wallpaper > - unloads the old wallpaper (to free memory) > > -- Hyprpaper [2] [1]: https://github.com/danth/stylix/issues/408 [2]: https://github.com/hyprwm/hyprpaper/blob/678d0e8959cf7adbc3825d578595e82305573991/README.md?plain=1#L103-L111 Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> --- flake.lock | 6 +++--- modules/hyprland/hm.nix | 10 ++++++++-- modules/hyprpaper/hm.nix | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 modules/hyprpaper/hm.nix diff --git a/flake.lock b/flake.lock index 82bf25d..75253f0 100644 --- a/flake.lock +++ b/flake.lock @@ -170,11 +170,11 @@ ] }, "locked": { - "lastModified": 1714981474, - "narHash": "sha256-b3/U21CJjCjJKmA9WqUbZGZgCvospO3ArOUTgJugkOY=", + "lastModified": 1715930644, + "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", "owner": "nix-community", "repo": "home-manager", - "rev": "6ebe7be2e67be7b9b54d61ce5704f6fb466c536f", + "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", "type": "github" }, "original": { diff --git a/modules/hyprland/hm.nix b/modules/hyprland/hm.nix index e6d77c1..746e7f7 100644 --- a/modules/hyprland/hm.nix +++ b/modules/hyprland/hm.nix @@ -24,6 +24,12 @@ in { options.stylix.targets.hyprland.enable = config.lib.stylix.mkEnableTarget "Hyprland" true; - config.wayland.windowManager.hyprland.settings = - lib.mkIf (config.stylix.enable && config.stylix.targets.hyprland.enable) settings; + config = + lib.mkIf + (config.stylix.enable && config.stylix.targets.hyprland.enable) + { + services.hyprpaper.enable = true; + stylix.targets.hyprpaper.enable = true; + wayland.windowManager.hyprland.settings = settings; + }; } diff --git a/modules/hyprpaper/hm.nix b/modules/hyprpaper/hm.nix new file mode 100644 index 0000000..dbb7b08 --- /dev/null +++ b/modules/hyprpaper/hm.nix @@ -0,0 +1,14 @@ +{ config, lib, ... }: { + options.stylix.targets.hyprpaper.enable = + config.lib.stylix.mkEnableTarget "Hyprpaper" true; + + config = + lib.mkIf + (config.stylix.enable && config.stylix.targets.hyprpaper.enable) + { + services.hyprpaper.settings = { + preload = [ "${config.stylix.image}" ]; + wallpaper = [ ",${config.stylix.image}" ]; + }; + }; +}