Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove 'rotdir' | simplify and improve directory rotation #1341

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
26 changes: 19 additions & 7 deletions .config/lf/lfrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,25 @@ 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=()
for file in "$dir"/*.{jpg,jpeg,png,webp,bmp,tiff,tif,raw,ico,exif,heic,heif,gif,avif,jxl,JPG,PNG}; do
[[ -f "$file" ]] && images+=("$file")
done
sorted_images=()
while IFS= read -r line; do
sorted_images+=("$line")
done < <(printf "%s\n" "${images[@]}" | sort -fV)
for ((i=0; i<${#sorted_images[@]}; i++)); do
[[ "${sorted_images[i]}" = "$selected_file" ]] && {
setsid nsxiv -aon "$((i + 1))" "${sorted_images[@]}"
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 ;;
Expand Down