diff --git a/modules/bar/widgets/Tray.qml b/modules/bar/widgets/Tray.qml index afc98a3..42bc2e5 100644 --- a/modules/bar/widgets/Tray.qml +++ b/modules/bar/widgets/Tray.qml @@ -92,6 +92,7 @@ Row { // Workspace Row Component.onCompleted: { // Default to the original icon let src = modelData.icon; + // console.log("########## icon: " + modelData.icon) // Check if there is a "?" in the URL (custom path) if (src.includes('goxlr')) { diff --git a/modules/wp/generate-wallpaper-thumbs.sh b/modules/wp/generate-wallpaper-thumbs.sh index b3d1ed8..57b83e7 100755 --- a/modules/wp/generate-wallpaper-thumbs.sh +++ b/modules/wp/generate-wallpaper-thumbs.sh @@ -10,7 +10,9 @@ if [ ! -d $THUMB_DIR ]; then mkdir -p $THUMB_DIR; fi - +shopt -s nullglob +files=( "$THUMB_DIR"/*.jpg "$THUMB_DIR"/*.jpeg "$THUMB_DIR"/*.png ) +# printf ' %s\n' "${files[@]}" # Make sure the thumb directory exists mkdir -p "$THUMB_DIR" @@ -19,6 +21,28 @@ MAX_DIM=300 num=0 +remove_from_array() { + local -n arr=$1 + local elem=$2 + local result=() + + # echo "=== Removing element: '$elem' ===" + # echo "Original array has ${#arr[@]} elements" + + for item in "${arr[@]}"; do + if [[ "$item" != "$elem" ]]; then + result+=( "$item" ) + # echo "Keeping: '$item'" + # else + # echo "Removing: '$item'" + fi + done + + arr=( "${result[@]}" ) + # echo "New array has ${#arr[@]} elements" + # echo "-----------------------------------" +} + # Process each image for img in "$WALLPAPER_DIR"/*.{jpg,jpeg,png}; do # Skip if no files match @@ -34,16 +58,18 @@ for img in "$WALLPAPER_DIR"/*.{jpg,jpeg,png}; do # Output path thumb="$THUMB_DIR/$fname" + # If thumbnail already exists and is newer than the original, skip if [ -f "$thumb" ] && [ "$thumb" -nt "$img" ]; then + remove_from_array files "$thumb" continue fi num+=1 # Generate thumbnail using ImageMagick - if [ -x "/usr/bin/magick" ] then + if [ -x "/usr/bin/magick" ]; then magick "$img" -resize "${MAX_DIM}x${MAX_DIM}" "$thumb" rm $temp_image_name else @@ -52,6 +78,16 @@ for img in "$WALLPAPER_DIR"/*.{jpg,jpeg,png}; do fi cp $img $temp_image_name fi + remove_from_array files "$thumb" +done + +# echo "" + +# printf ' %s\n' "${files[@]}" + +for img in $files; do + echo "$img" + rm $img done echo "$num Thumbnails generated in $THUMB_DIR" \ No newline at end of file