Browse Source

hotfix on wallpaper select

pull/40/head
JaKooLit 2 years ago
parent
commit
72a2ffbc89
  1. 30
      config/hypr/scripts/WallpaperSelect.sh

30
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

Loading…
Cancel
Save