mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
support imv in imgview and nuke
This commit is contained in:
parent
a103f513c3
commit
0f67e1ff7d
|
@ -45,7 +45,7 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`.
|
||||||
| [imgresize](imgresize) | Resize images in dir to screen resolution | sh | [imgp](https://github.com/jarun/imgp) |
|
| [imgresize](imgresize) | Resize images in dir to screen resolution | sh | [imgp](https://github.com/jarun/imgp) |
|
||||||
| [imgthumb](imgthumb) | View thumbnail of an image or dir of images | sh | [lsix](https://github.com/hackerb9/lsix) |
|
| [imgthumb](imgthumb) | View thumbnail of an image or dir of images | sh | [lsix](https://github.com/hackerb9/lsix) |
|
||||||
| [imgur](imgur) | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) | bash | - |
|
| [imgur](imgur) | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) | bash | - |
|
||||||
| [imgview](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|
|
| [imgview](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 | [imv](https://github.com/eXeC64/imv)/[sxiv](https://github.com/muennich/sxiv)/[viu](https://github.com/atanunq/viu), less|
|
||||||
| [ipinfo](ipinfo) | Fetch external IP address and whois information | sh | curl, whois |
|
| [ipinfo](ipinfo) | Fetch external IP address and whois information | sh | curl, whois |
|
||||||
| [kdeconnect](kdeconnect) | Send selected files to an Android device | sh | kdeconnect-cli |
|
| [kdeconnect](kdeconnect) | Send selected files to an Android device | sh | kdeconnect-cli |
|
||||||
| [launch](launch) | GUI application launcher | sh | fzf |
|
| [launch](launch) | GUI application launcher | sh | fzf |
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
# Description: Open images in hovered directory and thumbnails
|
# Description: Open images in hovered directory and thumbnails
|
||||||
# open hovered image in sxiv or viu and browse other images in the directory
|
# open hovered image in sxiv or viu and browse other images in the directory
|
||||||
|
# Dependencies: imv (https://github.com/eXeC64/imv) or,
|
||||||
|
# sxiv (https://github.com/muennich/sxiv) or,
|
||||||
|
# viu (https://github.com/atanunq/viu), less
|
||||||
#
|
#
|
||||||
# Shell: POSIX compliant
|
# Shell: POSIX compliant
|
||||||
# Author: Arun Prakash Jana
|
# Author: Arun Prakash Jana
|
||||||
|
@ -18,14 +21,15 @@ listimages() {
|
||||||
'.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z
|
'.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z
|
||||||
}
|
}
|
||||||
|
|
||||||
sxiv_view_dir() {
|
view_dir() {
|
||||||
target="$(abspath "$1")"
|
target="$(abspath "$2")"
|
||||||
count="$(listimages | grep -a -m 1 -ZznF "$target" | cut -d: -f1)"
|
count="$(listimages | grep -a -m 1 -ZznF "$target" | cut -d: -f1)"
|
||||||
|
|
||||||
if [ -n "$count" ]; then
|
if [ -n "$count" ]; then
|
||||||
listimages | xargs -0 sxiv -n "$count" --
|
listimages | xargs -0 "$1" -n "$count" --
|
||||||
else
|
else
|
||||||
sxiv -- "$@" # fallback
|
shift
|
||||||
|
"$1" -- "$@" # fallback
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,16 +39,22 @@ if [ -z "$1" ] || ! [ -s "$1" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v sxiv >/dev/null 2>&1; then
|
if command -v imvr >/dev/null 2>&1; then
|
||||||
if [ -f "$1" ]; then
|
if [ -f "$1" ]; then
|
||||||
sxiv_view_dir "$1" >/dev/null 2>&1 &
|
view_dir imvr "$1" >/dev/null 2>&1 &
|
||||||
|
elif [ -d "$1" ] || [ -h "$1" ]; then
|
||||||
|
imvr "$1" >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
|
elif command -v sxiv >/dev/null 2>&1; then
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
view_dir sxiv "$1" >/dev/null 2>&1 &
|
||||||
elif [ -d "$1" ] || [ -h "$1" ]; then
|
elif [ -d "$1" ] || [ -h "$1" ]; then
|
||||||
sxiv -qt "$1" >/dev/null 2>&1 &
|
sxiv -qt "$1" >/dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
elif command -v viu >/dev/null 2>&1; then
|
elif command -v viu >/dev/null 2>&1; then
|
||||||
viu -n "$1" | less -R
|
viu -n "$1" | less -R
|
||||||
else
|
else
|
||||||
printf "install sxiv or viu"
|
printf "install imv/sxiv/viu"
|
||||||
read -r _
|
read -r _
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
18
plugins/nuke
18
plugins/nuke
|
@ -51,7 +51,7 @@
|
||||||
# htm|html|xhtml: w3m, lynx, elinks
|
# htm|html|xhtml: w3m, lynx, elinks
|
||||||
# json: jq, python (json.tool module)
|
# json: jq, python (json.tool module)
|
||||||
# Multimedia by mime:
|
# Multimedia by mime:
|
||||||
# image/*: sxiv (GUI), viu (https://github.com/atanunq/viu), img2txt, exiftool
|
# image/*: imv/sxiv (GUI), viu (https://github.com/atanunq/viu), img2txt, exiftool
|
||||||
# video/*: smplayer, mpv (GUI), ffmpegthumbnailer, mediainfo, exiftool
|
# video/*: smplayer, mpv (GUI), ffmpegthumbnailer, mediainfo, exiftool
|
||||||
# audio/*: mocplay (nnn plugin using MOC), mpv, mediainfo, exiftool
|
# audio/*: mocplay (nnn plugin using MOC), mpv, mediainfo, exiftool
|
||||||
# application/pdf: zathura (GUI), pdftotext, mutool, exiftool
|
# application/pdf: zathura (GUI), pdftotext, mutool, exiftool
|
||||||
|
@ -257,14 +257,15 @@ listimages() {
|
||||||
'.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z
|
'.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z
|
||||||
}
|
}
|
||||||
|
|
||||||
sxiv_load_dir() {
|
load_dir() {
|
||||||
target="$(abspath "$1")"
|
target="$(abspath "$2")"
|
||||||
count="$(listimages | grep -a -m 1 -ZznF "$target" | cut -d: -f1)"
|
count="$(listimages | grep -a -m 1 -ZznF "$target" | cut -d: -f1)"
|
||||||
|
|
||||||
if [ -n "$count" ]; then
|
if [ -n "$count" ]; then
|
||||||
listimages | xargs -0 sxiv -n "$count" --
|
listimages | xargs -0 "$1" -n "$count" --
|
||||||
else
|
else
|
||||||
sxiv -- "$@" # fallback
|
shift
|
||||||
|
"$1" -- "$@" # fallback
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,8 +291,11 @@ handle_multimedia() {
|
||||||
|
|
||||||
## Image
|
## Image
|
||||||
image/*)
|
image/*)
|
||||||
if [ "$GUI" -ne 0 ] && which sxiv >/dev/null 2>&1; then
|
if [ "$GUI" -ne 0 ] && which imvr >/dev/null 2>&1; then
|
||||||
sxiv_load_dir "${FPATH}" >/dev/null 2>&1 &
|
load_dir imvr "${FPATH}" >/dev/null 2>&1 &
|
||||||
|
exit 0
|
||||||
|
elif [ "$GUI" -ne 0 ] && which sxiv >/dev/null 2>&1; then
|
||||||
|
load_dir sxiv "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
exit 0
|
||||||
elif which viu >/dev/null 2>&1; then
|
elif which viu >/dev/null 2>&1; then
|
||||||
viu -n "${FPATH}" | eval "$PAGER"
|
viu -n "${FPATH}" | eval "$PAGER"
|
||||||
|
|
Loading…
Reference in a new issue