feat(hyprpaper): now hovers over previously selected wallpaper
This commit is contained in:
@@ -22,13 +22,24 @@
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tmp_file=$(mktemp)
|
tmp_file=$(mktemp)
|
||||||
target_dir="$HOME/Pictures/Wallpapers"
|
LAST_WALLPAPER_FILE="$HOME/.cache/last_wallpaper_path"
|
||||||
if [ ! -d "$target_dir" ]; then
|
|
||||||
target_dir="$HOME"
|
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
|
fi
|
||||||
|
|
||||||
# Ensure we are in a terminal that supports yazi
|
# 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
|
if [ ! -f "$tmp_file" ]; then
|
||||||
echo "No selection file created."
|
echo "No selection file created."
|
||||||
@@ -46,6 +57,7 @@
|
|||||||
# Persistence logic
|
# Persistence logic
|
||||||
CACHE_FILE="$HOME/.cache/current_wallpaper"
|
CACHE_FILE="$HOME/.cache/current_wallpaper"
|
||||||
cp "$WALLPAPER" "$CACHE_FILE"
|
cp "$WALLPAPER" "$CACHE_FILE"
|
||||||
|
echo "$WALLPAPER" > "$HOME/.cache/last_wallpaper_path"
|
||||||
|
|
||||||
# Reload hyprpaper
|
# Reload hyprpaper
|
||||||
${pkgs.hyprland}/bin/hyprctl hyprpaper unload all
|
${pkgs.hyprland}/bin/hyprctl hyprpaper unload all
|
||||||
|
|||||||
Reference in New Issue
Block a user