mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
nlay - support multiple apps
This commit is contained in:
parent
b0efe4c642
commit
94ed36b498
|
@ -47,7 +47,7 @@ Noice is Not Noice, a noicer fork...
|
||||||
|
|
||||||
`nnn` is a fork of [noice](http://git.2f30.org/noice/), a blazing-fast lightweight terminal file browser with easy keyboard shortcuts for navigation, opening files and running tasks. noice is developed considering terminal based systems. There is no config file and mime associations are hard-coded. However, the incredible user-friendliness and speed make it a perfect utility on modern distros.
|
`nnn` is a fork of [noice](http://git.2f30.org/noice/), a blazing-fast lightweight terminal file browser with easy keyboard shortcuts for navigation, opening files and running tasks. noice is developed considering terminal based systems. There is no config file and mime associations are hard-coded. However, the incredible user-friendliness and speed make it a perfect utility on modern distros.
|
||||||
|
|
||||||
`nnn` can use the default desktop opener at runtime and handle media types with `nlay`, a customizable bash script. `nnn` adds new navigation options, [navigate-as-you-type](#navigate-as-you-type-mode) mode, enhanced DE integration, a disk usage analyzer mode, comprehensive file details and much more. Add to that a huge [performance](#performance) boost. For a detailed comparison, visit [nnn vs. noice](https://github.com/jarun/nnn/wiki/nnn-vs.-noice).
|
`nnn` can use the default desktop opener at runtime and handle media types with [nlay](https://github.com/jarun/nnn/wiki/all-about-nlay), a customizable bash script. `nnn` adds new navigation options, [navigate-as-you-type](#navigate-as-you-type-mode) mode, enhanced DE integration, a disk usage analyzer mode, comprehensive file details and much more. Add to that a huge [performance](#performance) boost. For a detailed comparison, visit [nnn vs. noice](https://github.com/jarun/nnn/wiki/nnn-vs.-noice).
|
||||||
|
|
||||||
If you want to edit a file in vim with some soothing music in the background while referring to a spec in your GUI PDF viewer, `nnn` got it! All from the same terminal session. Follow the instructions in the [quickstart](#quickstart) section and see how `nnn` simplifies those long desktop sessions...
|
If you want to edit a file in vim with some soothing music in the background while referring to a spec in your GUI PDF viewer, `nnn` got it! All from the same terminal session. Follow the instructions in the [quickstart](#quickstart) section and see how `nnn` simplifies those long desktop sessions...
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ Right, Enter, l, ^M | Open file or enter dir
|
||||||
& | Jump to initial dir
|
& | Jump to initial dir
|
||||||
- | Jump to last visited dir
|
- | Jump to last visited dir
|
||||||
/ | Filter dir contents
|
/ | Filter dir contents
|
||||||
^/ | Search dir in gnome-search-tool
|
^/ | Search dir in desktop search tool
|
||||||
. | Toggle hide .dot files
|
. | Toggle hide .dot files
|
||||||
c | Show change dir prompt
|
c | Show change dir prompt
|
||||||
d | Toggle detail view
|
d | Toggle detail view
|
||||||
|
@ -223,10 +223,10 @@ The following abbreviations are used in the detail view:
|
||||||
export NNN_OPENER=gvfs-open
|
export NNN_OPENER=gvfs-open
|
||||||
- If `nnn` recognizes the file extension, it invokes nlay (which invokes the players). Default apps:
|
- If `nnn` recognizes the file extension, it invokes nlay (which invokes the players). Default apps:
|
||||||
- mpv - audio and video
|
- mpv - audio and video
|
||||||
- viewnior - image
|
- viewnior, fim - image
|
||||||
- [zathura](https://pwmt.org/projects/zathura/) - pdf
|
- [zathura](https://pwmt.org/projects/zathura/) - pdf
|
||||||
- vim - plain text
|
- vim - plain text
|
||||||
- gnome-search-tool - search
|
- gnome-search-tool, catfish - search
|
||||||
- vlock - terminal screensaver
|
- vlock - terminal screensaver
|
||||||
- to add, remove recognized extensions in `nnn`, see [how to change file associations](#change-file-associations)
|
- to add, remove recognized extensions in `nnn`, see [how to change file associations](#change-file-associations)
|
||||||
- If a file without any extension is a plain text file, it is opened in EDITOR (fallback vi)
|
- If a file without any extension is a plain text file, it is opened in EDITOR (fallback vi)
|
||||||
|
|
73
nlay
73
nlay
|
@ -8,9 +8,9 @@
|
||||||
# MUST READ:
|
# MUST READ:
|
||||||
#
|
#
|
||||||
# 1. Feel free to change the default apps to your favourite ones.
|
# 1. Feel free to change the default apps to your favourite ones.
|
||||||
# If you change the app for a group you may also need to modify the bg
|
# If you change the app for a group you may also need to modify the opts and
|
||||||
# setting. If bg is set the app is detached and started in the background in
|
# bg settings. If bg is set the app is detached and started in the background
|
||||||
# silent mode.
|
# in silent mode.
|
||||||
#
|
#
|
||||||
# The bg setting depends on personal preference and type of app, e.g.,
|
# The bg setting depends on personal preference and type of app, e.g.,
|
||||||
# I would start vim (CLI) in the foreground but Sublime Text (GUI) in the
|
# I would start vim (CLI) in the foreground but Sublime Text (GUI) in the
|
||||||
|
@ -59,6 +59,7 @@ ENABLE_FILE_TYPE_HANDLING
|
||||||
#------------------ AUDIO -------------------
|
#------------------ AUDIO -------------------
|
||||||
if [ "$2" == "audio" ]; then
|
if [ "$2" == "audio" ]; then
|
||||||
app=mpv
|
app=mpv
|
||||||
|
|
||||||
# To start mpv in a window enable opts
|
# To start mpv in a window enable opts
|
||||||
#opts="--no-terminal --force-window"
|
#opts="--no-terminal --force-window"
|
||||||
|
|
||||||
|
@ -70,11 +71,11 @@ if [ "$2" == "audio" ]; then
|
||||||
|
|
||||||
eval $app $opts "\"$1\"" $bg
|
eval $app $opts "\"$1\"" $bg
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
|
||||||
|
|
||||||
#------------------ VIDEO -------------------
|
#------------------ VIDEO -------------------
|
||||||
if [ "$2" == "video" ]; then
|
elif [ "$2" == "video" ]; then
|
||||||
app=mpv
|
app=mpv
|
||||||
|
|
||||||
# To start mpv in a window enable opts
|
# To start mpv in a window enable opts
|
||||||
#opts="--no-terminal --force-window"
|
#opts="--no-terminal --force-window"
|
||||||
|
|
||||||
|
@ -86,59 +87,61 @@ if [ "$2" == "video" ]; then
|
||||||
|
|
||||||
eval $app $opts "\"$1\"" $bg
|
eval $app $opts "\"$1\"" $bg
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
|
||||||
|
|
||||||
#------------------ IMAGE -------------------
|
#------------------ IMAGE -------------------
|
||||||
if [ "$2" == "image" ]; then
|
elif [ "$2" == "image" ]; then
|
||||||
app=viewnior
|
app=("viewnior"
|
||||||
#opts=
|
"fim")
|
||||||
|
|
||||||
bg=">/dev/null 2>&1 &"
|
opts=(""
|
||||||
|
"-a --cd-and-readdir")
|
||||||
|
|
||||||
eval $app $opts "\"$1\"" $bg
|
bg=(">/dev/null 2>&1 &"
|
||||||
exit 0
|
">/dev/null 2>&1 &")
|
||||||
fi
|
|
||||||
|
|
||||||
#------------------- PDF --------------------
|
#------------------- PDF --------------------
|
||||||
if [ "$2" == "pdf" ]; then
|
elif [ "$2" == "pdf" ]; then
|
||||||
app=zathura
|
app=("zathura")
|
||||||
#opts=
|
|
||||||
|
|
||||||
bg=">/dev/null 2>&1 &"
|
opts=("")
|
||||||
|
|
||||||
eval $app $opts "\"$1\"" $bg
|
bg=(">/dev/null 2>&1 &")
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
#---------------- PLAINTEXT -----------------
|
#---------------- PLAINTEXT -----------------
|
||||||
if [ "$2" == "text" ]; then
|
elif [ "$2" == "text" ]; then
|
||||||
app=vim
|
app=("vim")
|
||||||
#opts=
|
|
||||||
|
|
||||||
#bg=">/dev/null 2>&1 &"
|
opts=("")
|
||||||
|
|
||||||
eval $app $opts "\"$1\"" $bg
|
bg=("")
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
#----------------- SEARCH -------------------
|
#----------------- SEARCH -------------------
|
||||||
if [ "$2" == "search" ]; then
|
elif [ "$2" == "search" ]; then
|
||||||
app=gnome-search-tool
|
app=("gnome-search-tool"
|
||||||
#opts=
|
"catfish")
|
||||||
|
|
||||||
bg=">/dev/null 2>&1 &"
|
opts=(""
|
||||||
|
"--path")
|
||||||
|
|
||||||
eval $app $opts --path "\"$1\"" $bg
|
bg=(">/dev/null 2>&1 &"
|
||||||
exit 0
|
">/dev/null 2>&1 &")
|
||||||
fi
|
|
||||||
|
|
||||||
#--------------- SCREENSAVER ----------------
|
#--------------- SCREENSAVER ----------------
|
||||||
if [ "$2" == "screensaver" ]; then
|
elif [ "$2" == "screensaver" ]; then
|
||||||
app=vlock
|
app=vlock
|
||||||
|
|
||||||
#opts=
|
#opts=
|
||||||
|
|
||||||
#bg=">/dev/null 2>&1 &"
|
#bg=">/dev/null 2>&1 &"
|
||||||
|
|
||||||
|
type -P $app &>/dev/null &&
|
||||||
eval $app $opts $bg
|
eval $app $opts $bg
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#------------------- PLAY -------------------
|
||||||
|
for index in ${!app[@]}
|
||||||
|
do
|
||||||
|
type -P ${app[$index]} &>/dev/null &&
|
||||||
|
eval ${app[$index]} ${opts[$index]} "\"$1\"" ${bg[$index]}
|
||||||
|
done
|
||||||
|
|
2
nnn.1
2
nnn.1
|
@ -54,7 +54,7 @@ Change to the last visited directory
|
||||||
.It Ic /
|
.It Ic /
|
||||||
Change filter (more information below)
|
Change filter (more information below)
|
||||||
.It Ic ^/
|
.It Ic ^/
|
||||||
Search directory in gnome-search-tool
|
Search directory in desktop search tool
|
||||||
.It Ic \&.
|
.It Ic \&.
|
||||||
Toggle hide .dot files
|
Toggle hide .dot files
|
||||||
.It Ic c
|
.It Ic c
|
||||||
|
|
2
nnn.c
2
nnn.c
|
@ -1259,7 +1259,7 @@ show_help(void)
|
||||||
& | Jump to initial dir\n\
|
& | Jump to initial dir\n\
|
||||||
- | Jump to last visited dir\n\
|
- | Jump to last visited dir\n\
|
||||||
/ | Filter dir contents\n\
|
/ | Filter dir contents\n\
|
||||||
^/ | Search dir in gnome-search-tool\n\
|
^/ | Search dir in desktop search tool\n\
|
||||||
. | Toggle hide .dot files\n\
|
. | Toggle hide .dot files\n\
|
||||||
c | Show change dir prompt\n\
|
c | Show change dir prompt\n\
|
||||||
d | Toggle detail view\n\
|
d | Toggle detail view\n\
|
||||||
|
|
Loading…
Reference in a new issue