aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rwxr-xr-xnlay73
-rw-r--r--nnn.12
-rw-r--r--nnn.c2
4 files changed, 44 insertions, 41 deletions
diff --git a/README.md b/README.md
index 3644a96..def02e4 100644
--- a/README.md
+++ b/README.md
@@ -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` 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...
@@ -164,7 +164,7 @@ Right, Enter, l, ^M | Open file or enter dir
& | Jump to initial dir
- | Jump to last visited dir
/ | Filter dir contents
- ^/ | Search dir in gnome-search-tool
+ ^/ | Search dir in desktop search tool
. | Toggle hide .dot files
c | Show change dir prompt
d | Toggle detail view
@@ -223,10 +223,10 @@ The following abbreviations are used in the detail view:
export NNN_OPENER=gvfs-open
- If `nnn` recognizes the file extension, it invokes nlay (which invokes the players). Default apps:
- mpv - audio and video
- - viewnior - image
+ - viewnior, fim - image
- [zathura](https://pwmt.org/projects/zathura/) - pdf
- vim - plain text
- - gnome-search-tool - search
+ - gnome-search-tool, catfish - search
- vlock - terminal screensaver
- 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)
diff --git a/nlay b/nlay
index 0685995..04dc464 100755
--- a/nlay
+++ b/nlay
@@ -8,9 +8,9 @@
# MUST READ:
#
# 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
-# setting. If bg is set the app is detached and started in the background in
-# silent mode.
+# If you change the app for a group you may also need to modify the opts and
+# bg settings. If bg is set the app is detached and started in the background
+# in silent mode.
#
# 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
@@ -59,6 +59,7 @@ ENABLE_FILE_TYPE_HANDLING
#------------------ AUDIO -------------------
if [ "$2" == "audio" ]; then
app=mpv
+
# To start mpv in a window enable opts
#opts="--no-terminal --force-window"
@@ -70,11 +71,11 @@ if [ "$2" == "audio" ]; then
eval $app $opts "\"$1\"" $bg
exit 0
-fi
#------------------ VIDEO -------------------
-if [ "$2" == "video" ]; then
+elif [ "$2" == "video" ]; then
app=mpv
+
# To start mpv in a window enable opts
#opts="--no-terminal --force-window"
@@ -86,59 +87,61 @@ if [ "$2" == "video" ]; then
eval $app $opts "\"$1\"" $bg
exit 0
-fi
#------------------ IMAGE -------------------
-if [ "$2" == "image" ]; then
- app=viewnior
- #opts=
+elif [ "$2" == "image" ]; then
+ app=("viewnior"
+ "fim")
- bg=">/dev/null 2>&1 &"
+ opts=(""
+ "-a --cd-and-readdir")
- eval $app $opts "\"$1\"" $bg
- exit 0
-fi
+ bg=(">/dev/null 2>&1 &"
+ ">/dev/null 2>&1 &")
#------------------- PDF --------------------
-if [ "$2" == "pdf" ]; then
- app=zathura
- #opts=
+elif [ "$2" == "pdf" ]; then
+ app=("zathura")
- bg=">/dev/null 2>&1 &"
+ opts=("")
- eval $app $opts "\"$1\"" $bg
- exit 0
-fi
+ bg=(">/dev/null 2>&1 &")
#---------------- PLAINTEXT -----------------
-if [ "$2" == "text" ]; then
- app=vim
- #opts=
+elif [ "$2" == "text" ]; then
+ app=("vim")
- #bg=">/dev/null 2>&1 &"
+ opts=("")
- eval $app $opts "\"$1\"" $bg
- exit 0
-fi
+ bg=("")
#----------------- SEARCH -------------------
-if [ "$2" == "search" ]; then
- app=gnome-search-tool
- #opts=
+elif [ "$2" == "search" ]; then
+ app=("gnome-search-tool"
+ "catfish")
- bg=">/dev/null 2>&1 &"
+ opts=(""
+ "--path")
- eval $app $opts --path "\"$1\"" $bg
- exit 0
-fi
+ bg=(">/dev/null 2>&1 &"
+ ">/dev/null 2>&1 &")
#--------------- SCREENSAVER ----------------
-if [ "$2" == "screensaver" ]; then
+elif [ "$2" == "screensaver" ]; then
app=vlock
+
#opts=
#bg=">/dev/null 2>&1 &"
+ type -P $app &>/dev/null &&
eval $app $opts $bg
exit 0
fi
+
+#------------------- PLAY -------------------
+for index in ${!app[@]}
+do
+ type -P ${app[$index]} &>/dev/null &&
+ eval ${app[$index]} ${opts[$index]} "\"$1\"" ${bg[$index]}
+done
diff --git a/nnn.1 b/nnn.1
index 4b4bbd0..95c0ec8 100644
--- a/nnn.1
+++ b/nnn.1
@@ -54,7 +54,7 @@ Change to the last visited directory
.It Ic /
Change filter (more information below)
.It Ic ^/
-Search directory in gnome-search-tool
+Search directory in desktop search tool
.It Ic \&.
Toggle hide .dot files
.It Ic c
diff --git a/nnn.c b/nnn.c
index 1b3aadb..ec9fce0 100644
--- a/nnn.c
+++ b/nnn.c
@@ -1259,7 +1259,7 @@ show_help(void)
& | Jump to initial dir\n\
- | Jump to last visited dir\n\
/ | Filter dir contents\n\
- ^/ | Search dir in gnome-search-tool\n\
+ ^/ | Search dir in desktop search tool\n\
. | Toggle hide .dot files\n\
c | Show change dir prompt\n\
d | Toggle detail view\n\