From 3b35cc12d34f37935afe65198cd641ad759bd3ab Mon Sep 17 00:00:00 2001 From: kenji Date: Sat, 27 Dec 2025 19:40:54 -0600 Subject: [PATCH] add: switch-wallpaper.nix --- apps/hyprpaper/switch-wallpaper.nix | 20 ++++++++++++++++++++ modules/home/hyprland.nix | 1 + 2 files changed, 21 insertions(+) create mode 100644 apps/hyprpaper/switch-wallpaper.nix diff --git a/apps/hyprpaper/switch-wallpaper.nix b/apps/hyprpaper/switch-wallpaper.nix new file mode 100644 index 0000000..467e6f7 --- /dev/null +++ b/apps/hyprpaper/switch-wallpaper.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + (writeShellScriptBin "switch-wallpaper" '' + WALLPAPER=$(${pkgs.zenity}/bin/zenity --file-selection --title="Select Wallpaper" --file-filter="Images | *.jpg *.jpeg *.png *.gif") + + if [ -z "$WALLPAPER" ]; then + exit 0 + fi + + # Preload and set wallpaper using hyprctl (requires hyprpaper running) + # We attempt to unload all other wallpapers first to save memory, optionally + # ${pkgs.hyprland}/bin/hyprctl hyprpaper unload all + + ${pkgs.hyprland}/bin/hyprctl hyprpaper preload "$WALLPAPER" + ${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$WALLPAPER" + '') + ]; +} diff --git a/modules/home/hyprland.nix b/modules/home/hyprland.nix index 9360d81..33292ff 100644 --- a/modules/home/hyprland.nix +++ b/modules/home/hyprland.nix @@ -5,6 +5,7 @@ ../../apps/walker/home.nix # ../../apps/fsel/home.nix ../../apps/hyprpaper/home.nix + ../../apps/hyprpaper/switch-wallpaper.nix ../../apps/tte/home.nix ]; }