hyprpaper: fix wallpaper IPC script (use writeShellScript)

The previous inline shell command had quoting/PATH issues. Replace with
a proper pkgs.writeShellScript that:
- Uses the full hyprctl store path (no PATH dependency)
- Reads the wallpaper from hyprpaper.conf at runtime ($HOME/.config)
- Avoids the Nix string-context conflict from embedding a store path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-18 10:18:15 +01:00
parent e90018d780
commit 542d5b1ee6

View file

@ -206,6 +206,13 @@ in
extraConfig =
let
# hyprpaper 0.8.4 bug: wallpaper= in config is silently ignored.
# preload= works; set the wallpaper via IPC after startup.
setWallpaper = pkgs.writeShellScript "set-hyprpaper-wallpaper" ''
sleep 2
wallpaper=$(grep '^preload=' "$HOME/.config/hypr/hyprpaper.conf" | head -1 | cut -d= -f2-)
${hyprland-pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper "${if isGaming then "DP-2" else "eDP-1"},$wallpaper"
'';
powerMenu = pkgs.writeShellScript "power-menu" ''
choice=$(printf '%s\n' \
$'\uf023 Lock' \
@ -268,11 +275,7 @@ in
hl.exec_cmd("hyprctl setcursor Bibata-Modern-Ice 24")
hl.exec_cmd("swayosd-server")
${lib.optionalString isMacbook ''hl.exec_cmd("hypridle")''}
-- hyprpaper 0.8.4 bug: wallpaper= in config is ignored on startup.
-- preload= works so the image is ready; use IPC to assign it.
-- Read the path from hyprpaper.conf at runtime to avoid Nix
-- string-context conflicts with the powerMenu derivation above.
hl.exec_cmd("sleep 2 && hyprctl hyprpaper wallpaper '${if isGaming then "DP-2" else "eDP-1"},'$(grep '^preload=' \"$XDG_CONFIG_HOME/hypr/hyprpaper.conf\" | head -1 | cut -d= -f2-)")
hl.exec_cmd("${setWallpaper}")
end)
-- Animation curve and definitions