diff options
| author | Jaël Champagne Gareau <gareau_jael@hotmail.com> | 2025-12-30 22:06:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-30 22:06:25 -0500 |
| commit | d05f22e5f4e92827ea69911cdd3dfc83c64c655c (patch) | |
| tree | e06b351e620f54654e6562a2d95bd3e0a286ccc8 | |
| parent | 330a934953fb79c56c60e2520210f8686b4c5459 (diff) | |
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>
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperRandom.sh | 5 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperSelect.sh | 3 | ||||
| -rw-r--r-- | config/hypr/configs/Startup_Apps.conf | 4 | ||||
| -rwxr-xr-x | config/hypr/scripts/DarkLight.sh | 3 | ||||
| -rwxr-xr-x | config/hypr/scripts/ScreenShot.sh | 3 | ||||
| -rwxr-xr-x | config/hypr/scripts/sddm_wallpaper.sh | 3 | ||||
| -rw-r--r-- | config/swappy/config | 2 | ||||
| -rwxr-xr-x | copy.sh | 11 |
8 files changed, 20 insertions, 14 deletions
diff --git a/config/hypr/UserScripts/WallpaperRandom.sh b/config/hypr/UserScripts/WallpaperRandom.sh index 654d4bd3..8dd680d5 100755 --- a/config/hypr/UserScripts/WallpaperRandom.sh +++ b/config/hypr/UserScripts/WallpaperRandom.sh @@ -2,12 +2,13 @@ # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # Script for Random Wallpaper ( CTRL ALT W) -wallDIR="$HOME/Pictures/wallpapers" +PICTURES_DIR="$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")" +wallDIR="$PICTURES_DIR/wallpapers" SCRIPTSDIR="$HOME/.config/hypr/scripts" focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name') -PICS=($(find -L ${wallDIR} -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.pnm" -o -name "*.tga" -o -name "*.tiff" -o -name "*.webp" -o -name "*.bmp" -o -name "*.farbfeld" -o -name "*.gif" \))) +PICS=($(find -L "${wallDIR}" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.pnm" -o -name "*.tga" -o -name "*.tiff" -o -name "*.webp" -o -name "*.bmp" -o -name "*.farbfeld" -o -name "*.gif" \))) RANDOMPICS=${PICS[ $RANDOM % ${#PICS[@]} ]} diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index 0029d3e5..3fd3b858 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -4,7 +4,8 @@ # WALLPAPERS PATH terminal=kitty -wallDIR="$HOME/Pictures/wallpapers" +PICTURES_DIR="$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")" +wallDIR="$PICTURES_DIR/wallpapers" SCRIPTSDIR="$HOME/.config/hypr/scripts" wallpaper_current="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" diff --git a/config/hypr/configs/Startup_Apps.conf b/config/hypr/configs/Startup_Apps.conf index 27c8d26a..550c79d4 100644 --- a/config/hypr/configs/Startup_Apps.conf +++ b/config/hypr/configs/Startup_Apps.conf @@ -4,7 +4,7 @@ $scriptsDir = $HOME/.config/hypr/scripts $UserScripts = $HOME/.config/hypr/UserScripts -$wallDIR=$HOME/Pictures/wallpapers +$wallDIR = $HOME/Pictures/wallpapers # change path manually here if needed $lock = $scriptsDir/LockScreen.sh $SwwwRandom = $UserScripts/WallpaperAutoChange.sh $livewallpaper="" @@ -53,7 +53,7 @@ exec-once = $scriptsDir/Hyprsunset.sh init # Here are list of features available but disabled by default # Persistent wallpaper -# exec-once = swww-daemon --format xrgb && swww img $HOME/Pictures/wallpapers/mecha-nostalgia.png +# exec-once = swww-daemon --format xrgb && swww img $wallDIR/mecha-nostalgia.png # Gnome polkit for NixOS #exec-once = $scriptsDir/Polkit-NixOS.sh diff --git a/config/hypr/scripts/DarkLight.sh b/config/hypr/scripts/DarkLight.sh index e473efb2..a225c7bc 100755 --- a/config/hypr/scripts/DarkLight.sh +++ b/config/hypr/scripts/DarkLight.sh @@ -4,7 +4,8 @@ # Note: Scripts are looking for keywords Light or Dark except for wallpapers as the are in a separate directories # Paths -wallpaper_base_path="$HOME/Pictures/wallpapers/Dynamic-Wallpapers" +PICTURES_DIR="$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")" +wallpaper_base_path="$PICTURES_DIR/wallpapers/Dynamic-Wallpapers" dark_wallpapers="$wallpaper_base_path/Dark" light_wallpapers="$wallpaper_base_path/Light" hypr_config_path="$HOME/.config/hypr" diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index 0ef70964..3d578a51 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -4,7 +4,8 @@ # variables time=$(date "+%d-%b_%H-%M-%S") -dir="$(xdg-user-dir PICTURES)/Screenshots" +PICTURES_DIR="$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")" +dir="$PICTURES_DIR/Screenshots" file="Screenshot_${time}_${RANDOM}.png" iDIR="$HOME/.config/swaync/icons" diff --git a/config/hypr/scripts/sddm_wallpaper.sh b/config/hypr/scripts/sddm_wallpaper.sh index 9dca2f72..5ebab44c 100755 --- a/config/hypr/scripts/sddm_wallpaper.sh +++ b/config/hypr/scripts/sddm_wallpaper.sh @@ -6,7 +6,8 @@ # variables terminal=kitty -wallDIR="$HOME/Pictures/wallpapers" +PICTURES_DIR="$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")" +wallDIR="$PICTURES_DIR/wallpapers" SCRIPTSDIR="$HOME/.config/hypr/scripts" wallpaper_current="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" wallpaper_modified="$HOME/.config/hypr/wallpaper_effects/.wallpaper_modified" diff --git a/config/swappy/config b/config/swappy/config index 45d84e49..ea04ccc2 100644 --- a/config/swappy/config +++ b/config/swappy/config @@ -1,5 +1,5 @@ [Default] -save_dir=$HOME/Pictures/Screenshots +save_dir=$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")/Screenshots save_filename_format=swappy-%Y%m%d-%H%M%S.png show_pannel=false line_size=5 @@ -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 |
