Compare commits

...

10 Commits

Author SHA1 Message Date
Oktay Imanzade c1cfc3604e
Merge be03c21a84 into ad04944bdf 2024-04-08 23:58:07 +03:00
Arun ad04944bdf
Merge pull request #1865 from flipflop133/patch-1
preview-tui: add svg support
2024-04-08 18:04:00 +05:30
François Bechet 133c0d329b preview-tui: add full svg support 2024-04-08 13:55:21 +02:00
Oktay Imanzade be03c21a84
preview-tabbed: simplified thubmnail view check 2024-04-04 20:37:32 +04:00
Oktay Imanzade ac6b31ad0e
preview-tabbed: fixed not removing tab after leaving PICTURES folder 2024-03-29 20:02:04 +04:00
Oktay Imanzade 0c28e160b8
Merge branch 'jarun:master' into master 2024-03-17 17:37:04 +04:00
Oktay Imanzade 7b232440de
preview-tabbed: fixed if statement again 2024-02-29 04:40:33 +04:00
Oktay Imanzade ecc0a4d38b
preview-tabbed: fixed if statement 2024-02-29 04:30:06 +04:00
Oktay Imanzade 7efd6db873
preview-tabbed: if Pictures folder has no supported images use nnn 2024-02-29 04:09:31 +04:00
Oktay Imanzade 094f16df5d
preview-tabbed: show sxiv/nsxiv in thumbnail mode when showing Pictures folder 2024-02-29 03:20:49 +04:00
2 changed files with 21 additions and 3 deletions

View File

@ -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

View File

@ -44,6 +44,7 @@
# - optional: pistol file viewer (https://github.com/doronbehar/pistol).
# 1. install pistol
# 2. set/export $NNN_PISTOL as 1
# - optional: librsvg for rsvg-convert
#
# Usage:
# You need to set a NNN_FIFO path and a key for the plugin with NNN_PLUG,
@ -94,7 +95,7 @@
# 'no_focus [title="preview-tui"]' to your i3 config file.
#
# Shell: Bash (for environment manipulation through arrays)
# Authors: Todd Yamakawa, Léo Villeveygoux, @Recidiviste, Mario Ortiz Manero, Luuk van Baal, @WanderLanz
# Authors: Todd Yamakawa, Léo Villeveygoux, @Recidiviste, Mario Ortiz Manero, Luuk van Baal, @WanderLanz, @flipflop133
# Configurable environment variables:
NNN_SPLIT=${NNN_SPLIT:-} # permanent split direction
@ -416,7 +417,9 @@ generate_preview() {
else
image_preview "$1" "$2" "$3" && return
fi ;;
image) if exists convert; then
image) if exists rsvg-convert && [[ "${3##*.}" == "svg" ]]; then
rsvg-convert -a -w "$NNN_PREVIEWWIDTH" -h "$NNN_PREVIEWHEIGHT" -f png -o "$NNN_PREVIEWDIR/$3.png" "$3"
elif exists convert; then
convert "$3" -flatten -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$NNN_PREVIEWDIR/$3.jpg"
else
image_preview "$1" "$2" "$3" && return
@ -431,6 +434,8 @@ generate_preview() {
fi
if [ -f "$NNN_PREVIEWDIR/$3.jpg" ]; then
image_preview "$1" "$2" "$NNN_PREVIEWDIR/$3.jpg"
elif [[ "${3##*.}" == "svg" ]] && [ -f "$NNN_PREVIEWDIR/$3.png" ]; then
image_preview "$1" "$2" "$NNN_PREVIEWDIR/$3.png"
else
fifo_pager print_bin_info "$3"
fi