diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2020-01-03 00:27:28 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2020-01-03 00:27:28 +0530 |
commit | 045ad3da75503b091d7b93f41ff7a0159a1a11e9 (patch) | |
tree | 60a5b5ee42930ead032d32487d7e5238181b64ce /plugins/imgview | |
parent | 69377bbd89ba1dd6a3213e43d94d91d9c8914036 (diff) | |
download | nnn-045ad3da75503b091d7b93f41ff7a0159a1a11e9.tar.gz |
Merge plugins imgsxiv and imgviu
Diffstat (limited to 'plugins/imgview')
-rwxr-xr-x | plugins/imgview | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/imgview b/plugins/imgview new file mode 100755 index 0000000..dc4d3a4 --- /dev/null +++ b/plugins/imgview @@ -0,0 +1,27 @@ +#!/usr/bin/env sh + +# Description: Open images in hovered directory and thumbnails +# open hovered image in sxiv or viu and browse other images in the directory +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +if [ -z "$1" ] || ! [ -s "$1" ]; then + printf "empty file" + read -r _ + exit 1 +fi + +if command -v sxiv >/dev/null 2>&1; then + if [ -f "$1" ]; then + sxiv -q "$1" "$PWD" + elif [ -d "$1" ] || [ -h "$1" ]; then + sxiv -qt "$1" + fi +elif command -v viu >/dev/null 2>&1; then + viu -n "$1" | less -R +else + printf "install sxiv or viu" + read -r _ + exit 2 +fi |