From d05f22e5f4e92827ea69911cdd3dfc83c64c655c Mon Sep 17 00:00:00 2001 From: Jaƫl Champagne Gareau Date: Tue, 30 Dec 2025 22:06:25 -0500 Subject: fix: respect XDG dir instead of forcing ~/Pictures (#899) * fix: respect XDG dir instead of forcing ~/Pictures * fix: make xdg-user-dir usage more robust --------- Co-authored-by: Donald Williams <129223418+dwilliam62@users.noreply.github.com> --- copy.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'copy.sh') diff --git a/copy.sh b/copy.sh index 5b3d17cd..e925a698 100755 --- a/copy.sh +++ b/copy.sh @@ -1087,8 +1087,9 @@ fi printf "\n%.0s" {1..1} # wallpaper stuff -mkdir -p $HOME/Pictures/wallpapers -if cp -r wallpapers $HOME/Pictures/; then +PICTURES_DIR="$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")" +mkdir -p "$PICTURES_DIR/wallpapers" +if cp -r wallpapers "$PICTURES_DIR/"; then echo "${OK} Some ${MAGENTA}wallpapers${RESET} copied successfully!" | tee -a "$LOG" else echo "${ERROR} Failed to copy some ${YELLOW}wallpapers${RESET}" | tee -a "$LOG" @@ -1168,12 +1169,12 @@ while true; do echo "${OK} Wallpapers downloaded successfully." 2>&1 | tee -a "$LOG" # Check if wallpapers directory exists and create it if not - if [ ! -d "$HOME/Pictures/wallpapers" ]; then - mkdir -p "$HOME/Pictures/wallpapers" + if [ ! -d "$PICTURES_DIR/wallpapers" ]; then + mkdir -p "$PICTURES_DIR/wallpapers" echo "${OK} Created wallpapers directory." 2>&1 | tee -a "$LOG" fi - if cp -R Wallpaper-Bank/wallpapers/* "$HOME/Pictures/wallpapers/" >>"$LOG" 2>&1; then + if cp -R Wallpaper-Bank/wallpapers/* "$PICTURES_DIR/wallpapers/" >>"$LOG" 2>&1; then echo "${OK} Wallpapers copied successfully." 2>&1 | tee -a "$LOG" rm -rf Wallpaper-Bank 2>&1 # Remove cloned repository after copying wallpapers break -- cgit v1.2.3