nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit b20886a29cf7153546ac27e4e990f4ed6fece215
parent ad04944bdf9f4c2dc936a5a843040bf6966e619a
Author: Oktay Imanzade <50494084+TheUtopian@users.noreply.github.com>
Date:   Thu, 18 Apr 2024 20:18:24 +0400

preview-tabbed: show (n)sxiv in thumbnail mode when watching "Pictures" directory
Diffstat:
Mplugins/preview-tabbed | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git 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 [[ -n $PICTURES_DIR && "$FILE" == "$PICTURES_DIR"* ]] ; then + if type sxiv >/dev/null 2>&1 ; then + sxiv -te "$XID" "$FILE" & + elif type nsxiv >/dev/null 2>&1 ; then + nsxiv -te "$XID" "$FILE" & + else + $TERMINAL "$XID" -e nnn "$FILE" & + fi + else + $TERMINAL "$XID" -e nnn "$FILE" & + fi ;; text/*) if [ -x "$NUKE" ] ; then