Retire nlay

This commit is contained in:
Arun Prakash Jana 2018-11-10 12:06:21 +05:30
parent a095ff485d
commit 497911e999
No known key found for this signature in database
GPG key ID: A75979F35C080412
9 changed files with 20 additions and 45 deletions

View file

@ -16,12 +16,11 @@ else
LDLIBS += -lncurses LDLIBS += -lncurses
endif endif
DISTFILES = nlay nlay.1 nnn.c nnn.h nnn.1 Makefile README.md LICENSE DISTFILES = nnn.c nnn.h nnn.1 Makefile README.md LICENSE
SRC = nnn.c SRC = nnn.c
BIN = nnn BIN = nnn
PLAYER = nlay
all: $(BIN) $(PLAYER) all: $(BIN)
$(SRC): nnn.h $(SRC): nnn.h
@ -33,16 +32,13 @@ debug: $(SRC)
install: all install: all
$(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin $(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin
$(INSTALL) -m 0755 $(BIN) $(PLAYER) $(DESTDIR)$(PREFIX)/bin $(INSTALL) -m 0755 $(BIN) $(DESTDIR)$(PREFIX)/bin
$(INSTALL) -m 0755 -d $(DESTDIR)$(MANPREFIX)/man1 $(INSTALL) -m 0755 -d $(DESTDIR)$(MANPREFIX)/man1
$(INSTALL) -m 0644 $(BIN).1 $(DESTDIR)$(MANPREFIX)/man1 $(INSTALL) -m 0644 $(BIN).1 $(DESTDIR)$(MANPREFIX)/man1
$(INSTALL) -m 0644 $(PLAYER).1 $(DESTDIR)$(MANPREFIX)/man1
uninstall: uninstall:
$(RM) $(DESTDIR)$(PREFIX)/bin/$(BIN) $(RM) $(DESTDIR)$(PREFIX)/bin/$(BIN)
$(RM) $(DESTDIR)$(PREFIX)/bin/$(PLAYER)
$(RM) $(DESTDIR)$(MANPREFIX)/man1/$(BIN).1 $(RM) $(DESTDIR)$(MANPREFIX)/man1/$(BIN).1
$(RM) $(DESTDIR)$(MANPREFIX)/man1/$(PLAYER).1
strip: $(BIN) strip: $(BIN)
$(STRIP) $^ $(STRIP) $^

View file

@ -184,7 +184,7 @@ Search keyword and option completion scripts for Bash, Fish and Zsh can be found
``` ```
usage: nnn [-b key] [-c N] [-e] [-i] [-l] usage: nnn [-b key] [-c N] [-e] [-i] [-l]
[-p nlay] [-S] [-v] [-h] [PATH] [-S] [-v] [-h] [PATH]
The missing terminal file manager for X. The missing terminal file manager for X.
@ -197,7 +197,6 @@ optional args:
-e use exiftool instead of mediainfo -e use exiftool instead of mediainfo
-i start in navigate-as-you-type mode -i start in navigate-as-you-type mode
-l start in light mode -l start in light mode
-p nlay path to custom nlay
-S start in disk usage analyser mode -S start in disk usage analyser mode
-v show program version -v show program version
-h show this help -h show this help
@ -346,8 +345,6 @@ The following indicators are used in the detail view:
export NNN_USE_EDITOR=1 export NNN_USE_EDITOR=1
Customizable script [nlay](https://github.com/jarun/nnn/wiki/all-about-nlay) is used to run terminal locker.
#### Help #### Help
$ nnn -h $ nnn -h

13
nnn.1
View file

@ -11,7 +11,6 @@
.Op Ar -e .Op Ar -e
.Op Ar -i .Op Ar -i
.Op Ar -l .Op Ar -l
.Op Ar -p nlay
.Op Ar -S .Op Ar -S
.Op Ar -v .Op Ar -v
.Op Ar -h .Op Ar -h
@ -152,9 +151,6 @@ supports the following options:
.Fl l .Fl l
start in light mode (fewer details) start in light mode (fewer details)
.Pp .Pp
.Fl "p nlay"
path to custom nlay
.Pp
.Fl S .Fl S
start in disk usage analyzer mode start in disk usage analyzer mode
.Pp .Pp
@ -165,14 +161,7 @@ supports the following options:
show program help and exit show program help and exit
.Sh CONFIGURATION .Sh CONFIGURATION
.Nm .Nm
uses \fIxdg-open\fR (on Linux) and \fIopen(1)\fR (on OS X) as the desktop uses \fIxdg-open\fR (on Linux) and \fIopen(1)\fR (on OS X) as the desktop opener.
opener. It invokes
.Pa nlay
to run the terminal locker. Read more on
.Pa nlay
at:
.br
.Em https://github.com/jarun/nnn/wiki/all-about-nlay
.Pp .Pp
There is no configuration file. Settings work on environment variables. Please There is no configuration file. Settings work on environment variables. Please
refer to the ENVIRONMENT section below. refer to the ENVIRONMENT section below.

33
nnn.c
View file

@ -284,7 +284,6 @@ static char *pnamebuf, *pcopybuf;
static int ndents, cur, total_dents = ENTRY_INCR; static int ndents, cur, total_dents = ENTRY_INCR;
static uint idle; static uint idle;
static uint idletimeout, copybufpos, copybuflen; static uint idletimeout, copybufpos, copybuflen;
static char *player;
static char *copier; static char *copier;
static char *editor; static char *editor;
static blkcnt_t ent_blocks; static blkcnt_t ent_blocks;
@ -322,10 +321,10 @@ static struct timespec gtimeout;
#define MEDIAINFO 0 #define MEDIAINFO 0
#define EXIFTOOL 1 #define EXIFTOOL 1
#define OPENER 2 #define OPENER 2
#define NLAY 3 #define ATOOL 3
#define ATOOL 4 #define APACK 4
#define APACK 5 #define VIDIR 5
#define VIDIR 6 #define LOCKER 6
#define UNKNOWN 7 #define UNKNOWN 7
/* Utilities to open files, run actions */ /* Utilities to open files, run actions */
@ -339,10 +338,16 @@ static char * const utils[] = {
#else #else
"xdg-open", "xdg-open",
#endif #endif
"nlay",
"atool", "atool",
"apack", "apack",
"vidir", "vidir",
#ifdef __APPLE__
"bashlock",
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
"lock",
#else
"vlock",
#endif
"UNKNOWN" "UNKNOWN"
}; };
@ -3282,7 +3287,7 @@ nochange:
spawn(run, dents[cur].name, NULL, path, F_NORMAL); spawn(run, dents[cur].name, NULL, path, F_NORMAL);
break; break;
case SEL_LOCK: case SEL_LOCK:
spawn(player, "", "screensaver", NULL, F_NORMAL | F_SIGINT); spawn(utils[LOCKER], NULL, NULL, NULL, F_NORMAL | F_SIGINT);
break; break;
case SEL_QUITCTX: case SEL_QUITCTX:
{ {
@ -3337,7 +3342,7 @@ nochange:
/* Screensaver */ /* Screensaver */
if (idletimeout != 0 && idle == idletimeout) { if (idletimeout != 0 && idle == idletimeout) {
idle = 0; idle = 0;
spawn(player, "", "screensaver", NULL, F_NORMAL | F_SIGINT); spawn(utils[LOCKER], NULL, NULL, NULL, F_NORMAL | F_SIGINT);
} }
} }
} }
@ -3346,7 +3351,7 @@ static void usage(void)
{ {
fprintf(stdout, fprintf(stdout,
"usage: nnn [-b key] [-c N] [-e] [-i] [-l]\n" "usage: nnn [-b key] [-c N] [-e] [-i] [-l]\n"
" [-p nlay] [-S] [-v] [-h] [PATH]\n\n" " [-S] [-v] [-h] [PATH]\n\n"
"The missing terminal file manager for X.\n\n" "The missing terminal file manager for X.\n\n"
"positional args:\n" "positional args:\n"
" PATH start dir [default: current dir]\n\n" " PATH start dir [default: current dir]\n\n"
@ -3356,7 +3361,6 @@ static void usage(void)
" -e use exiftool instead of mediainfo\n" " -e use exiftool instead of mediainfo\n"
" -i start in navigate-as-you-type mode\n" " -i start in navigate-as-you-type mode\n"
" -l start in light mode\n" " -l start in light mode\n"
" -p nlay path to custom nlay\n"
" -S start in disk usage analyser mode\n" " -S start in disk usage analyser mode\n"
" -v show program version\n" " -v show program version\n"
" -h show this help\n\n" " -h show this help\n\n"
@ -3376,7 +3380,7 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
while ((opt = getopt(argc, argv, "Slib:c:ep:vh")) != -1) { while ((opt = getopt(argc, argv, "Slib:c:evh")) != -1) {
switch (opt) { switch (opt) {
case 'S': case 'S':
cfg.blkorder = 1; cfg.blkorder = 1;
@ -3401,9 +3405,6 @@ int main(int argc, char *argv[])
case 'e': case 'e':
cfg.metaviewer = EXIFTOOL; cfg.metaviewer = EXIFTOOL;
break; break;
case 'p':
player = optarg;
break;
case 'v': case 'v':
fprintf(stdout, "%s\n", VERSION); fprintf(stdout, "%s\n", VERSION);
return 0; return 0;
@ -3464,10 +3465,6 @@ int main(int argc, char *argv[])
editor = xgetenv("EDITOR", "vi"); editor = xgetenv("EDITOR", "vi");
} }
/* Set player if not set already */
if (!player)
player = utils[NLAY];
/* Get screensaver wait time, if set; copier used as tmp var */ /* Get screensaver wait time, if set; copier used as tmp var */
copier = getenv("NNN_IDLE_TIMEOUT"); copier = getenv("NNN_IDLE_TIMEOUT");
if (copier) { if (copier) {

View file

@ -16,13 +16,11 @@ _nnn () {
-h -h
-i -i
-l -l
-p
-S -S
-v -v
) )
opts_with_arg=( opts_with_arg=(
-c -c
-p
) )
# Do not complete non option names # Do not complete non option names

View file

@ -10,6 +10,5 @@ complete -c nnn -s e -d 'use exiftool instead of mediainfo'
complete -c nnn -s h -d 'show this help and exit' complete -c nnn -s h -d 'show this help and exit'
complete -c nnn -s i -d 'start in navigate-as-you-type mode' complete -c nnn -s i -d 'start in navigate-as-you-type mode'
complete -c nnn -s l -d 'start in light mode (fewer details)' complete -c nnn -s l -d 'start in light mode (fewer details)'
complete -c nnn -s p -r -d 'specify custom nlay'
complete -c nnn -s S -d 'start in disk usage analyzer mode' complete -c nnn -s S -d 'start in disk usage analyzer mode'
complete -c nnn -s v -d 'show program version and exit' complete -c nnn -s v -d 'show program version and exit'

View file

@ -14,7 +14,6 @@ args=(
'(-h)-h[show this help and exit]' '(-h)-h[show this help and exit]'
'(-i)-i[start in navigate-as-you-type mode]' '(-i)-i[start in navigate-as-you-type mode]'
'(-l)-l[start in light mode (fewer details)]' '(-l)-l[start in light mode (fewer details)]'
'(-p)-p[specify custom nlay]:path to nlay'
'(-S)-S[start in disk usage analyzer mode]' '(-S)-S[start in disk usage analyzer mode]'
'(-v)-v[show program version and exit]' '(-v)-v[show program version and exit]'
'*:filename:_files' '*:filename:_files'