浏览代码

support imv in imgview and nuke

master
Arun Prakash Jana 4 年前
父节点
当前提交
0f67e1ff7d
找不到此签名对应的密钥 GPG 密钥 ID: A75979F35C080412
共有 3 个文件被更改,包括 29 次插入15 次删除
  1. +1
    -1
      plugins/README.md
  2. +17
    -7
      plugins/imgview
  3. +11
    -7
      plugins/nuke

+ 1
- 1
plugins/README.md 查看文件

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


+ 17
- 7
plugins/imgview 查看文件

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

+ 11
- 7
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"


||||||
x
 
000:0
正在加载...
取消
保存