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 ]; }