Merge plugins imgsxiv and imgviu

This commit is contained in:
Arun Prakash Jana 2020-01-03 00:27:28 +05:30
parent 69377bbd89
commit 045ad3da75
No known key found for this signature in database
GPG key ID: A75979F35C080412
4 changed files with 28 additions and 32 deletions

View file

@ -27,10 +27,9 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina
| gutenread | Browse, download, read from Project Gutenberg | sh | curl, unzip, w3m<br>[epr](https://github.com/wustho/epr) (optional) |
| hexview | View a file in hex in `$PAGER` | sh | xxd |
| imgresize | Resize images in dir to screen resolution | sh | [imgp](https://github.com/jarun/imgp) |
| imgsxiv | Browse images, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts)), [rename](https://github.com/jarun/nnn/wiki/Basic-use-cases#browse-rename-images)| sh | sxiv |
| imgthumb | View thumbnail of an image or dir of images | sh | [lsix](https://github.com/hackerb9/lsix) |
| imgur | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) | bash | - |
| imgviu | View an image or images in dir in `$PAGER` | sh | [viu](https://github.com/atanunq/viu), less |
| imgview | Browse images, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts)), [rename](https://github.com/jarun/nnn/wiki/Basic-use-cases#browse-rename-images)| sh | sxiv/[viu](https://github.com/atanunq/viu), less|
| ipinfo | Fetch external IP address and whois information | sh | curl, whois |
| kdeconnect | Send selected files to an Android device | sh | kdeconnect-cli |
| launch | GUI application launcher | sh | fzf/fzy |

View file

@ -1,20 +0,0 @@
#!/usr/bin/env sh
# Description: Open images in hovered directory and thumbnails
# open hovered image in sxiv and browse other images in the directory
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
if command -v sxiv >/dev/null 2>&1; then
if ! [ -z "$1" ]; then
if [ -f "$1" ]; then
sxiv -q "$1" "$PWD"
elif [ -d "$1" ] || [ -h "$1" ]; then
sxiv -qt "$1"
fi
fi
else
echo "sxiv missing"
read -r _
fi

27
plugins/imgview Executable file
View file

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

View file

@ -1,10 +0,0 @@
#!/usr/bin/env sh
# Description: View an image or images in a directory in $PAGER
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
if ! [ -z "$1" ]; then
viu -n "$1" | less -R
fi