Integrate bashlock and lock

This commit is contained in:
Arun Prakash Jana 2018-09-06 19:42:02 +05:30
parent 028e04abd3
commit 776c94a744
No known key found for this signature in database
GPG key ID: A75979F35C080412
5 changed files with 11 additions and 18 deletions

View file

@ -109,7 +109,7 @@ Have fun with it! Missing a feature? Want to contribute? Head to the rolling [To
- Change directory at exit (*easy* shell integration) - Change directory at exit (*easy* shell integration)
- Open any file in EDITOR (fallback vi) or PAGER (fallback less) - Open any file in EDITOR (fallback vi) or PAGER (fallback less)
- Open current directory in a custom GUI file manager - Open current directory in a custom GUI file manager
- Terminal screensaver/locker (default vlock, customizable) integration - Terminal screensaver/locker integration
- Unicode support - Unicode support
- Highly optimized code, minimal resource usage - Highly optimized code, minimal resource usage
@ -303,7 +303,7 @@ The following indicators are used in the detail view:
| gnome-search-tool, catfish | desktop search utility | | gnome-search-tool, catfish | desktop search utility |
| atool, patool ([integration](#integrate-patool)) | create, list and extract archives | | atool, patool ([integration](#integrate-patool)) | create, list and extract archives |
| vidir from moreutils | batch rename, move, delete dir entries | | vidir from moreutils | batch rename, move, delete dir entries |
| vlock (Linux) | terminal locker | | vlock (Linux), bashlock (OS X), lock (BSD) | terminal locker |
| $EDITOR ($VISUAL, if defined) | edit files (fallback vi) | | $EDITOR ($VISUAL, if defined) | edit files (fallback vi) |
| $PAGER | page through files (fallback less) | | $PAGER | page through files (fallback less) |
| $SHELL | spawn a shell, run script (fallback sh) | | $SHELL | spawn a shell, run script (fallback sh) |

15
nlay
View file

@ -74,15 +74,16 @@ elif [ "$2" == "search" ]; then
#--------------- SCREENSAVER ---------------- #--------------- SCREENSAVER ----------------
elif [ "$2" == "screensaver" ]; then elif [ "$2" == "screensaver" ]; then
app=vlock app=("vlock"
"bashlock"
"lock")
#opts= for index in ${!app[@]}
do
#bg=">/dev/null 2>&1 &" type -P ${app[$index]} &>/dev/null &&
eval ${app[$index]} &&
type -P $app &>/dev/null &&
eval $app $opts $bg
exit 0 exit 0
done
#------------------ SCRIPT ------------------ #------------------ SCRIPT ------------------
elif [ "$2" == "script" ]; then elif [ "$2" == "script" ]; then

2
nlay.1
View file

@ -11,7 +11,7 @@ file/path type/action
.Nm .Nm
is shipped with \fInnn\fR to deliver a level of flexibility to users to choose their own apps when running some actions, run some commands or custom scripts. It has provisions to handle text files too. However, the capability is not used in the latest releases. Now is shipped with \fInnn\fR to deliver a level of flexibility to users to choose their own apps when running some actions, run some commands or custom scripts. It has provisions to handle text files too. However, the capability is not used in the latest releases. Now
.Nm .Nm
is invoked to run a desktop search utility (\fIgnome-search-tool\fR or \fIcatfish\fR in the same order of priority) or screen locker (\fIvlock\fR, Linux-only). However, is invoked to run a desktop search (\fIgnome-search-tool\fR or \fIcatfish\fR) or screen locker (\fIvlock\fR or \fIbashlock\fR or \fIlock\fR) utility. However,
.Nm .Nm
can run independently and can be highly customized for personal usage. can run independently and can be highly customized for personal usage.
.Pp .Pp

4
nnn.c
View file

@ -1953,9 +1953,7 @@ show_help(char *path)
"d^Y | Toggle multi-copy\n" "d^Y | Toggle multi-copy\n"
"d^T | Toggle path quote\n" "d^T | Toggle path quote\n"
"d^L | Redraw, clear prompt\n" "d^L | Redraw, clear prompt\n"
#ifdef __linux__
"eL | Lock terminal\n" "eL | Lock terminal\n"
#endif
"e? | Help, settings\n" "e? | Help, settings\n"
"aQ, ^G | Quit and cd\n" "aQ, ^G | Quit and cd\n"
"aq, ^X | Quit\n\n"}; "aq, ^X | Quit\n\n"};
@ -3241,11 +3239,9 @@ nochange:
run = editor ? editor : xgetenv("EDITOR", "vi"); run = editor ? editor : xgetenv("EDITOR", "vi");
spawn(run, dents[cur].name, NULL, path, F_NORMAL); spawn(run, dents[cur].name, NULL, path, F_NORMAL);
break; break;
#ifdef __linux__
case SEL_LOCK: case SEL_LOCK:
spawn(player, "", "screensaver", NULL, F_NORMAL | F_SIGINT); spawn(player, "", "screensaver", NULL, F_NORMAL | F_SIGINT);
break; break;
#endif
case SEL_CDQUIT: case SEL_CDQUIT:
{ {
tmp = getenv("NNN_TMPFILE"); tmp = getenv("NNN_TMPFILE");

4
nnn.h
View file

@ -45,9 +45,7 @@ enum action {
SEL_RUN, SEL_RUN,
SEL_RUNSCRIPT, SEL_RUNSCRIPT,
SEL_RUNARG, SEL_RUNARG,
#ifdef __linux__
SEL_LOCK, SEL_LOCK,
#endif
SEL_CDQUIT, SEL_CDQUIT,
SEL_QUIT, SEL_QUIT,
}; };
@ -180,10 +178,8 @@ static struct key bindings[] = {
/* Run command with argument */ /* Run command with argument */
{ 'e', SEL_RUNARG, "", "VISUAL" }, { 'e', SEL_RUNARG, "", "VISUAL" },
{ 'p', SEL_RUNARG, "less", "PAGER" }, { 'p', SEL_RUNARG, "less", "PAGER" },
#ifdef __linux__
/* Lock screen */ /* Lock screen */
{ 'L', SEL_LOCK, "", "" }, { 'L', SEL_LOCK, "", "" },
#endif
/* Change dir on quit */ /* Change dir on quit */
{ 'Q', SEL_CDQUIT, "", "" }, { 'Q', SEL_CDQUIT, "", "" },
{ CONTROL('G'), SEL_CDQUIT, "", "" }, { CONTROL('G'), SEL_CDQUIT, "", "" },