commit 776c94a74481c6b67e0f62327eb41374fe353207
parent 028e04abd35d2c306b27b445e4be59329f57d88f
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date: Thu, 6 Sep 2018 19:42:02 +0530
Integrate bashlock and lock
Diffstat:
5 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
@@ -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)
- Open any file in EDITOR (fallback vi) or PAGER (fallback less)
- Open current directory in a custom GUI file manager
- - Terminal screensaver/locker (default vlock, customizable) integration
+ - Terminal screensaver/locker integration
- Unicode support
- 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 |
| atool, patool ([integration](#integrate-patool)) | create, list and extract archives |
| 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) |
| $PAGER | page through files (fallback less) |
| $SHELL | spawn a shell, run script (fallback sh) |
diff --git a/nlay b/nlay
@@ -74,15 +74,16 @@ elif [ "$2" == "search" ]; then
#--------------- SCREENSAVER ----------------
elif [ "$2" == "screensaver" ]; then
- app=vlock
+ app=("vlock"
+ "bashlock"
+ "lock")
- #opts=
-
- #bg=">/dev/null 2>&1 &"
-
- type -P $app &>/dev/null &&
- eval $app $opts $bg
+for index in ${!app[@]}
+do
+ type -P ${app[$index]} &>/dev/null &&
+ eval ${app[$index]} &&
exit 0
+done
#------------------ SCRIPT ------------------
elif [ "$2" == "script" ]; then
diff --git a/nlay.1 b/nlay.1
@@ -11,7 +11,7 @@ file/path type/action
.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
.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
can run independently and can be highly customized for personal usage.
.Pp
diff --git a/nnn.c b/nnn.c
@@ -1953,9 +1953,7 @@ show_help(char *path)
"d^Y | Toggle multi-copy\n"
"d^T | Toggle path quote\n"
"d^L | Redraw, clear prompt\n"
-#ifdef __linux__
"eL | Lock terminal\n"
-#endif
"e? | Help, settings\n"
"aQ, ^G | Quit and cd\n"
"aq, ^X | Quit\n\n"};
@@ -3241,11 +3239,9 @@ nochange:
run = editor ? editor : xgetenv("EDITOR", "vi");
spawn(run, dents[cur].name, NULL, path, F_NORMAL);
break;
-#ifdef __linux__
case SEL_LOCK:
spawn(player, "", "screensaver", NULL, F_NORMAL | F_SIGINT);
break;
-#endif
case SEL_CDQUIT:
{
tmp = getenv("NNN_TMPFILE");
diff --git a/nnn.h b/nnn.h
@@ -45,9 +45,7 @@ enum action {
SEL_RUN,
SEL_RUNSCRIPT,
SEL_RUNARG,
-#ifdef __linux__
SEL_LOCK,
-#endif
SEL_CDQUIT,
SEL_QUIT,
};
@@ -180,10 +178,8 @@ static struct key bindings[] = {
/* Run command with argument */
{ 'e', SEL_RUNARG, "", "VISUAL" },
{ 'p', SEL_RUNARG, "less", "PAGER" },
-#ifdef __linux__
/* Lock screen */
{ 'L', SEL_LOCK, "", "" },
-#endif
/* Change dir on quit */
{ 'Q', SEL_CDQUIT, "", "" },
{ CONTROL('G'), SEL_CDQUIT, "", "" },