From 53f9e2d9256a69c8f628ad821e4056ec8fb08956 Mon Sep 17 00:00:00 2001 From: kenji Date: Sun, 31 May 2026 12:21:53 -0500 Subject: [PATCH] feat(hyprpaper): now hovers over previously selected wallpaper --- apps/hyprpaper/default.nix | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/hyprpaper/default.nix b/apps/hyprpaper/default.nix index d0c92ad..e3ccb0f 100644 --- a/apps/hyprpaper/default.nix +++ b/apps/hyprpaper/default.nix @@ -22,13 +22,24 @@ fi tmp_file=$(mktemp) - target_dir="$HOME/Pictures/Wallpapers" - if [ ! -d "$target_dir" ]; then - target_dir="$HOME" + LAST_WALLPAPER_FILE="$HOME/.cache/last_wallpaper_path" + + if [ -f "$LAST_WALLPAPER_FILE" ]; then + last_path=$(cat "$LAST_WALLPAPER_FILE") + if [ -f "$last_path" ]; then + yazi_target="$last_path" + fi + fi + + if [ -z "$yazi_target" ]; then + yazi_target="$HOME/Pictures/Wallpapers" + if [ ! -d "$yazi_target" ]; then + yazi_target="$HOME" + fi fi # Ensure we are in a terminal that supports yazi - ${pkgs.yazi}/bin/yazi "$target_dir" --chooser-file="$tmp_file" + ${pkgs.yazi}/bin/yazi "$yazi_target" --chooser-file="$tmp_file" if [ ! -f "$tmp_file" ]; then echo "No selection file created." @@ -46,6 +57,7 @@ # Persistence logic CACHE_FILE="$HOME/.cache/current_wallpaper" cp "$WALLPAPER" "$CACHE_FILE" + echo "$WALLPAPER" > "$HOME/.cache/last_wallpaper_path" # Reload hyprpaper ${pkgs.hyprland}/bin/hyprctl hyprpaper unload all