From 094f16df5d5546e42010c1cba1421292a1334550 Mon Sep 17 00:00:00 2001 From: Oktay Imanzade <50494084+TheUtopian@users.noreply.github.com> Date: Thu, 29 Feb 2024 03:20:49 +0400 Subject: [PATCH] preview-tabbed: show sxiv/nsxiv in thumbnail mode when showing Pictures folder --- plugins/preview-tabbed | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/preview-tabbed b/plugins/preview-tabbed index 68d8d1ab..59e4bc77 100755 --- a/plugins/preview-tabbed +++ b/plugins/preview-tabbed @@ -69,6 +69,9 @@ else echo "No xembed term found" >&2 fi +if type xdg-user-dir >/dev/null 2>&1 ; then + PICTURES_DIR=$(xdg-user-dir PICTURES) +fi term_nuke () { # $1 -> $XID, $2 -> $FILE @@ -177,7 +180,17 @@ previewer_loop () { fi ;; inode/directory) - $TERMINAL "$XID" -e nnn "$FILE" & + if [[ -z $PICTURES_DIR && "$FILE" == *"$PICTURES_DIR"* ]]; then + if type sxiv >/dev/null 2>&1 ; then + sxiv -te "$XID" "$FILE" 2>/dev/null & + elif type nsxiv >/dev/null 2>&1 ; then + nsxiv -te "$XID" "$FILE" 2>/dev/null & + else + $TERMINAL "$XID" -e nnn "$FILE" & + fi + else + $TERMINAL "$XID" -e nnn "$FILE" & + fi ;; text/*) if [ -x "$NUKE" ] ; then