mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Minor changes to nuke
This commit is contained in:
parent
88f71ff35d
commit
53e98a9fd1
57
plugins/nuke
57
plugins/nuke
|
@ -86,67 +86,68 @@ is_mac() {
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_pdf() {
|
handle_pdf() {
|
||||||
if [ "$GUI" -ne 0 ] && is_mac; then
|
if [ "$GUI" -ne 0 ]; then
|
||||||
|
if is_mac; then
|
||||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
elif type zathura >/dev/null 2>&1; then
|
||||||
elif [ "$GUI" -ne 0 ] && type zathura >/dev/null 2>&1; then
|
|
||||||
nohup zathura "${FPATH}" >/dev/null 2>&1 &
|
nohup zathura "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
else
|
||||||
|
return
|
||||||
|
fi
|
||||||
elif type pdftotext >/dev/null 2>&1; then
|
elif type pdftotext >/dev/null 2>&1; then
|
||||||
## Preview as text conversion
|
## Preview as text conversion
|
||||||
pdftotext -l 10 -nopgbrk -q -- "${FPATH}" - | eval "$PAGER"
|
pdftotext -l 10 -nopgbrk -q -- "${FPATH}" - | eval "$PAGER"
|
||||||
exit 0
|
|
||||||
elif type mutool >/dev/null 2>&1; then
|
elif type mutool >/dev/null 2>&1; then
|
||||||
mutool draw -F txt -i -- "${FPATH}" 1-10 | eval "$PAGER"
|
mutool draw -F txt -i -- "${FPATH}" 1-10 | eval "$PAGER"
|
||||||
exit 0
|
|
||||||
elif type exiftool >/dev/null 2>&1; then
|
elif type exiftool >/dev/null 2>&1; then
|
||||||
exiftool "${FPATH}" | eval "$PAGER"
|
exiftool "${FPATH}" | eval "$PAGER"
|
||||||
exit 0
|
else
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_audio() {
|
handle_audio() {
|
||||||
if type mocp >/dev/null 2>&1 && type mocq >/dev/null 2>&1; then
|
if type mocp >/dev/null 2>&1 && type mocq >/dev/null 2>&1; then
|
||||||
mocq "${FPATH}" "opener" >/dev/null 2>&1
|
mocq "${FPATH}" "opener" >/dev/null 2>&1
|
||||||
exit 0
|
|
||||||
elif type mpv >/dev/null 2>&1; then
|
elif type mpv >/dev/null 2>&1; then
|
||||||
mpv "${FPATH}" >/dev/null 2>&1 &
|
mpv "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
|
||||||
elif type media_client >/dev/null 2>&1; then
|
elif type media_client >/dev/null 2>&1; then
|
||||||
media_client play "${FPATH}" >/dev/null 2>&1 &
|
media_client play "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
|
||||||
elif type mediainfo >/dev/null 2>&1; then
|
elif type mediainfo >/dev/null 2>&1; then
|
||||||
mediainfo "${FPATH}" | eval "$PAGER"
|
mediainfo "${FPATH}" | eval "$PAGER"
|
||||||
exit 0
|
|
||||||
elif type exiftool >/dev/null 2>&1; then
|
elif type exiftool >/dev/null 2>&1; then
|
||||||
exiftool "${FPATH}"| eval "$PAGER"
|
exiftool "${FPATH}"| eval "$PAGER"
|
||||||
exit 0
|
else
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_video() {
|
handle_video() {
|
||||||
if [ "$GUI" -ne 0 ] && is_mac; then
|
if [ "$GUI" -ne 0 ]; then
|
||||||
|
if is_mac; then
|
||||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
elif type smplayer >/dev/null 2>&1; then
|
||||||
elif [ "$GUI" -ne 0 ] && type smplayer >/dev/null 2>&1; then
|
|
||||||
nohup smplayer "${FPATH}" >/dev/null 2>&1 &
|
nohup smplayer "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
elif type mpv >/dev/null 2>&1; then
|
||||||
elif [ "$GUI" -ne 0 ] && type mpv >/dev/null 2>&1; then
|
|
||||||
nohup mpv "${FPATH}" >/dev/null 2>&1 &
|
nohup mpv "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
else
|
||||||
|
return
|
||||||
|
fi
|
||||||
elif type ffmpegthumbnailer >/dev/null 2>&1; then
|
elif type ffmpegthumbnailer >/dev/null 2>&1; then
|
||||||
# Thumbnail
|
# Thumbnail
|
||||||
[ -d "${IMAGE_CACHE_PATH}" ] || mkdir "${IMAGE_CACHE_PATH}"
|
[ -d "${IMAGE_CACHE_PATH}" ] || mkdir "${IMAGE_CACHE_PATH}"
|
||||||
ffmpegthumbnailer -i "${FPATH}" -o "${IMAGE_CACHE_PATH}/${FNAME}.jpg" -s 0
|
ffmpegthumbnailer -i "${FPATH}" -o "${IMAGE_CACHE_PATH}/${FNAME}.jpg" -s 0
|
||||||
viu -n "${IMAGE_CACHE_PATH}/${FNAME}.jpg" | eval "$PAGER"
|
viu -n "${IMAGE_CACHE_PATH}/${FNAME}.jpg" | eval "$PAGER"
|
||||||
exit 0
|
|
||||||
elif type mediainfo >/dev/null 2>&1; then
|
elif type mediainfo >/dev/null 2>&1; then
|
||||||
mediainfo "${FPATH}" | eval "$PAGER"
|
mediainfo "${FPATH}" | eval "$PAGER"
|
||||||
exit 0
|
|
||||||
elif type exiftool >/dev/null 2>&1; then
|
elif type exiftool >/dev/null 2>&1; then
|
||||||
exiftool "${FPATH}"| eval "$PAGER"
|
exiftool "${FPATH}"| eval "$PAGER"
|
||||||
exit 0
|
else
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# handle this extension and exit
|
# handle this extension and exit
|
||||||
|
@ -306,15 +307,17 @@ handle_multimedia() {
|
||||||
|
|
||||||
## Image
|
## Image
|
||||||
image/*)
|
image/*)
|
||||||
if [ "$GUI" -ne 0 ] && is_mac; then
|
if [ "$GUI" -ne 0 ]; then
|
||||||
|
if is_mac; then
|
||||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
exit 0
|
||||||
elif [ "$GUI" -ne 0 ] && type imvr >/dev/null 2>&1; then
|
elif type imvr >/dev/null 2>&1; then
|
||||||
load_dir imvr "${FPATH}" >/dev/null 2>&1 &
|
load_dir imvr "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
exit 0
|
||||||
elif [ "$GUI" -ne 0 ] && type sxiv >/dev/null 2>&1; then
|
elif type sxiv >/dev/null 2>&1; then
|
||||||
load_dir sxiv "${FPATH}" >/dev/null 2>&1 &
|
load_dir sxiv "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
exit 0
|
||||||
|
fi
|
||||||
elif type viu >/dev/null 2>&1; then
|
elif type viu >/dev/null 2>&1; then
|
||||||
viu -n "${FPATH}" | eval "$PAGER"
|
viu -n "${FPATH}" | eval "$PAGER"
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -477,13 +480,15 @@ handle_mime() {
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_fallback() {
|
handle_fallback() {
|
||||||
if [ "$GUI" -ne 0 ] && type xdg-open >/dev/null 2>&1; then
|
if [ "$GUI" -ne 0 ]; then
|
||||||
|
if type xdg-open >/dev/null 2>&1; then
|
||||||
nohup xdg-open "${FPATH}" >/dev/null 2>&1 &
|
nohup xdg-open "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
exit 0
|
||||||
elif [ "$GUI" -ne 0 ] && type open >/dev/null 2>&1; then
|
elif type open >/dev/null 2>&1; then
|
||||||
nohup open "${FPATH}" >/dev/null 2>&1 &
|
nohup open "${FPATH}" >/dev/null 2>&1 &
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo '----- File details -----' && file --dereference --brief -- "${FPATH}"
|
echo '----- File details -----' && file --dereference --brief -- "${FPATH}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in a new issue