aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/WallpaperSelect.sh
diff options
context:
space:
mode:
Diffstat (limited to 'config/hypr/scripts/WallpaperSelect.sh')
-rwxr-xr-xconfig/hypr/scripts/WallpaperSelect.sh30
1 files changed, 22 insertions, 8 deletions
diff --git a/config/hypr/scripts/WallpaperSelect.sh b/config/hypr/scripts/WallpaperSelect.sh
index 398fafb1..a3fa1ba0 100755
--- a/config/hypr/scripts/WallpaperSelect.sh
+++ b/config/hypr/scripts/WallpaperSelect.sh
@@ -3,7 +3,7 @@
SCRIPTSDIR="$HOME/.config/hypr/scripts"
# WALLPAPERS PATH
-DIR="$HOME/Pictures/wallpapers/"
+DIR="$HOME/Pictures/wallpapers"
# Transition config
FPS=30
@@ -28,14 +28,13 @@ menu() {
for i in "${!PICS[@]}"; do
# Displaying .gif to indicate animated images
if [[ -z $(echo "${PICS[$i]}" | grep .gif$) ]]; then
- filename=$(basename "${PICS[$i]}" | sed 's/\.[^.]*$//') # Remove file extension
- printf "%s\n" "${filename//[[:digit:]]/}" # Remove leading numbers
+ printf "$(echo "${PICS[$i]}" | cut -d. -f1)\n"
else
- printf "%s\n" "${PICS[$i]}"
+ printf "${PICS[$i]}\n"
fi
done
- printf "%s\n" "$RANDOM_PIC_NAME"
+ printf "$RANDOM_PIC_NAME\n"
}
swww query || swww init
@@ -54,8 +53,22 @@ main() {
exit 0
fi
- pic_index=$(printf '%s\n' "${!PICS[@]}" | grep -E "\b${choice}\b") # Get index based on choice
- swww img "${DIR}/${PICS[$pic_index]}" $SWWW_PARAMS
+ # Find the index of the selected file
+ pic_index=-1
+ for i in "${!PICS[@]}"; do
+ filename=$(basename "${PICS[$i]}")
+ if [[ "$filename" == "$choice"* ]]; then
+ pic_index=$i
+ break
+ fi
+ done
+
+ if [[ $pic_index -ne -1 ]]; then
+ swww img "${DIR}/${PICS[$pic_index]}" $SWWW_PARAMS
+ else
+ echo "Image not found."
+ exit 1
+ fi
}
# Check if rofi is already running
@@ -67,4 +80,5 @@ fi
main
${SCRIPTSDIR}/PywalSwww.sh &
-${SCRIPTSDIR}/Refresh.sh
+sleep 1
+${SCRIPTSDIR}/Refresh.sh
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage