diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 25fb3d1e..a8eb2c57 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -34,13 +34,18 @@ cmd open ${{ text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; image/svg+xml) display -- $f ;; - image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" | - setsid -f sxiv -aio 2>/dev/null | while read -r file; do - [ -z "$file" ] && continue - lf -remote "send select \"$file\"" - lf -remote "send toggle" - done & - ;; + image/*) bash -c ' + shopt -s nullglob + dir="$0" + selected_file="$1" + images=($(ls "$dir"/*.{jpg,jpeg,png,webp,bmp,tiff,tif,raw,ico,exif,heic,heif,gif,avif,jxl} | sort -V)) + for ((i=0; i<${#images[@]}; i++)); do + [[ "${images[i]}" = "$selected_file" ]] && { + sxiv -abiof "${images[@]:i}" "${images[@]:0:i}" + break + } + done + ' "$PWD" "$fx";; audio/*|video/x-ms-asf) mpv --audio-display=no $f ;; video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;