add: switch-wallpaper.nix

This commit is contained in:
kenji
2025-12-27 19:40:54 -06:00
parent 08b78610f3
commit 3b35cc12d3
2 changed files with 21 additions and 0 deletions
+20
View File
@@ -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"
'')
];
}