Env var NNN_LOCKER

This commit is contained in:
Arun Prakash Jana 2020-04-16 00:29:45 +05:30
parent 135172a1c6
commit 63c177bb15
No known key found for this signature in database
GPG key ID: A75979F35C080412
3 changed files with 13 additions and 14 deletions

View file

@ -144,7 +144,7 @@ A curses library with wide char support (e.g. ncursesw), libreadline (optional)
| archivemount, fusermount(3)/umount (macOS) | optional | mount, unmount archives | | archivemount, fusermount(3)/umount (macOS) | optional | mount, unmount archives |
| sshfs, [rclone](https://rclone.org/), fusermount(3)/umount (macOS) | optional | mount, unmount remotes | | sshfs, [rclone](https://rclone.org/), fusermount(3)/umount (macOS) | optional | mount, unmount remotes |
| trash-cli | optional | trash files (default action: rm) | | trash-cli | optional | trash files (default action: rm) |
| vlock (Linux), bashlock (macOS), lock(1) (BSD),<br>peaclock (Haiku) | optional | terminal locker (fallback: [cmatrix](https://github.com/abishekvashok/cmatrix)) | | vlock (Linux), bashlock (macOS), lock(1) (BSD),<br>peaclock (Haiku) | optional | terminal locker (else `$NNN_LOCKER`) |
| advcpmv (Linux) ([integration](https://github.com/jarun/nnn/wiki/Advanced-use-cases#cp-mv-progress)) | optional | copy, move progress | | advcpmv (Linux) ([integration](https://github.com/jarun/nnn/wiki/Advanced-use-cases#cp-mv-progress)) | optional | copy, move progress |
| fortune | optional | random quotes in help screen | | fortune | optional | random quotes in help screen |
| `$VISUAL` (else `$EDITOR`), `$PAGER`, `$SHELL` | optional | fallback vi, less, sh | | `$VISUAL` (else `$EDITOR`), `$PAGER`, `$SHELL` | optional | fallback vi, less, sh |

6
nnn.1
View file

@ -407,6 +407,12 @@ separated by \fI;\fR:
export NNN_TRASH=1 export NNN_TRASH=1
.Ed .Ed
.Pp .Pp
\fBNNN_LOCKER:\fR terminal locker program.
.Bd -literal
export NNN_LOCKER='bmon -p wlp1s0'
export NNN_LOCKER='cmatrix'
.Ed
.Pp
\fBNNN_MCLICK:\fR key emulated by a middle mouse click. \fBNNN_MCLICK:\fR key emulated by a middle mouse click.
.Bd -literal .Bd -literal
export NNN_MCLICK='^R' export NNN_MCLICK='^R'

View file

@ -416,9 +416,9 @@ static uint g_states;
#define UTIL_UNZIP 3 #define UTIL_UNZIP 3
#define UTIL_TAR 4 #define UTIL_TAR 4
#define UTIL_LOCKER 5 #define UTIL_LOCKER 5
#define UTIL_CMATRIX 6 #define UTIL_LAUNCH 6
#define UTIL_LAUNCH 7 #define UTIL_SH_EXEC 7
#define UTIL_SH_EXEC 8 #define UTIL_BASH 8
#define UTIL_ARCHIVEMOUNT 9 #define UTIL_ARCHIVEMOUNT 9
#define UTIL_SSHFS 10 #define UTIL_SSHFS 10
#define UTIL_RCLONE 11 #define UTIL_RCLONE 11
@ -429,8 +429,7 @@ static uint g_states;
#define UTIL_FZY 16 #define UTIL_FZY 16
#define UTIL_NTFY 17 #define UTIL_NTFY 17
#define UTIL_CBCP 18 #define UTIL_CBCP 18
#define UTIL_BASH 19 #define UTIL_NMV 19
#define UTIL_NMV 20
/* Utilities to open files, run actions */ /* Utilities to open files, run actions */
static char * const utils[] = { static char * const utils[] = {
@ -456,9 +455,9 @@ static char * const utils[] = {
#else #else
"vlock", "vlock",
#endif #endif
"cmatrix",
"launch", "launch",
"sh -c", "sh -c",
"bash",
"archivemount", "archivemount",
"sshfs", "sshfs",
"rclone", "rclone",
@ -469,7 +468,6 @@ static char * const utils[] = {
"fzy", "fzy",
".ntfy", ".ntfy",
".cbcp", ".cbcp",
"bash",
".nmv", ".nmv",
}; };
@ -3969,12 +3967,7 @@ static bool unmount(char *name, char *newpath, int *presel, char *currentpath)
static void lock_terminal(void) static void lock_terminal(void)
{ {
char *tmp = utils[UTIL_LOCKER]; spawn(xgetenv("NNN_LOCKER", utils[UTIL_LOCKER]), NULL, NULL, NULL, F_CLI);
if (!getutil(tmp))
tmp = utils[UTIL_CMATRIX];
spawn(tmp, NULL, NULL, NULL, F_NORMAL);
} }
static void printkv(kv *kvarr, FILE *fp, uchar max) static void printkv(kv *kvarr, FILE *fp, uchar max)