]> Sergey Matveev's repositories - nnn.git/commitdiff
nlaunch: add sleep to wait for child
authorArun Prakash Jana <engineerarun@gmail.com>
Sun, 28 Apr 2019 15:18:14 +0000 (20:48 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 22 May 2019 03:14:19 +0000 (08:44 +0530)
scripts/nlaunch/README.md
scripts/nlaunch/nlaunch
src/nnn.c

index ef59d18f6468a6632f00a3df6fefcd5c36fdc937..8268bb38266dbbbea08b74279699c806f14bbd8e 100644 (file)
@@ -1 +1,5 @@
 `nlaunch` is an independent POSIX-compliant GUI application launcher shell script. Its only dependency is `fzy`. It's possible to set a keyboard shortcut to open `nlaunch` in a terminal and use it as the regular launcher.
+
+To use `nlaunch` as an independent launcher add a keybind to open `nlaunch` in a terminal e.g.
+
+    xfce4-terminal -e nlaunch
index e5b0a7bf87bf7219357d33f35f407e412ca51e6a..123e62dad24ebbc46298e9ad5f7dd9eb09a59d09 100755 (executable)
@@ -6,6 +6,9 @@
 #
 #              Requires fzy.
 #
+#              Usage: nlaunch [delay]
+#                     delay is in seconds, if omitted nlaunch waits for 1 sec
+#
 # Shell: POSIX compliant
 # Author: Arun Prakash Jana
 
@@ -17,4 +20,10 @@ get_selection() {
 
 if selection=$( get_selection ); then
     setsid "$selection" 2>/dev/null 1>/dev/null &
+
+    if ! [ -z "$1" ]; then
+        sleep "$1"
+    else
+        sleep 1
+    fi
 fi
index 7b4c7e46b0ece14b40a3f831ccd124fd8f0eb0de..1042b764d122e368afab35fbfc32a1d19f5b0d5e 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3985,7 +3985,7 @@ nochange:
                                goto begin;
                        case SEL_LAUNCH:
                                if (getutil(utils[NLAUNCH])) {
-                                       spawn(utils[NLAUNCH], NULL, NULL, path, F_NORMAL);
+                                       spawn(utils[NLAUNCH], "0", NULL, path, F_NORMAL);
                                        break;
                                } // fallthrough
                        default: /* SEL_RUNCMD */