]> Sergey Matveev's repositories - nnn.git/commitdiff
Integrate bashlock and lock
authorArun Prakash Jana <engineerarun@gmail.com>
Thu, 6 Sep 2018 14:12:02 +0000 (19:42 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Thu, 6 Sep 2018 14:21:30 +0000 (19:51 +0530)
README.md
nlay
nlay.1
nnn.c
nnn.h

index 2424d454f9291e217894568aed9bde94964334a7..a2e439db2197f3c9efcf855ba3f03deb60b410f7 100644 (file)
--- 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
index 23890b045b2a4daee9433beb1d80348093d4e06a..1930379ebcdc84920a6749d70cc32264af51f512 100755 (executable)
--- 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
index 7e90870ad80aad453b533c248e0f5b9398c4b839..9df0e012a5fd66df0bd740e3023b8d4ffa7c7f9f 100644 (file)
--- 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
index a8bbfc04f7413e8a6c53dcf4694b914f72e21115..bb40085268065cf0b2738b8f705f2874db8cb973 100644 (file)
--- 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
index e68f7cb000b7425c78d098790cb243a1e224c6e5..87023e73cba153f9c6fbc4d7dedf5011f468a5a1 100644 (file)
--- 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,    "",     "" },