]> Sergey Matveev's repositories - nnn.git/commitdiff
Do not wait when spawning DE file manager
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 22 Apr 2017 14:19:00 +0000 (19:49 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 22 Apr 2017 14:19:00 +0000 (19:49 +0530)
README.md
nnn.1
nnn.c

index 0aae778222213956dc85ee1bedbae8a3f4a0773c..ba253e5203d20e32355cb8c480d515e7ac1f9d2e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -139,8 +139,8 @@ nnn needs libreadline, libncursesw (on Linux or ncurses on OS X) and standard li
 | `c` | Show change dir prompt |
 | `d` | Toggle detail view |
 | `D` | Toggle current file details screen |
-| `m` | Show concise mediainfo in less |
-| `M` | Show full mediainfo in less |
+| `m` | Show concise mediainfo |
+| `M` | Show full mediainfo |
 | `.` | Toggle hide .dot files |
 | `s` | Toggle sort by file size |
 | `S` | Toggle disk usage analyzer mode |
diff --git a/nnn.1 b/nnn.1
index ea676254029d457a50fb88f2d97be172785e09b4..8b74150a07fae358b26c745933f066bbee772a5f 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -56,9 +56,9 @@ Toggle detail view
 .It Ic D
 Toggle current file details screen
 .It Ic m
-Show concise mediainfo in less
+Show concise mediainfo
 .It Ic M
-Show full mediainfo in less
+Show full mediainfo
 .It Ic \&.
 Toggle hide .dot files
 .It Ic s
diff --git a/nnn.c b/nnn.c
index 446d498a07c309004e69b5f1d338d059802f71bb..b847f9985efa0dc49c6cd62d7ddad6765328c9ca 100644 (file)
--- a/nnn.c
+++ b/nnn.c
@@ -280,8 +280,13 @@ xdirname(const char *path)
        return buf;
 }
 
+/*
+ * Spawns a child process. Behaviour can be controlled using flag:
+ * flag = 1: draw a marker to indicate nnn spawned e.g., a shell
+ * flag = 2: do not wait in parent for child process e.g. DE file manager
+ */
 static void
-spawn(char *file, char *arg, char *dir, int notify)
+spawn(char *file, char *arg, char *dir, int flag)
 {
        pid_t pid;
        int status;
@@ -290,14 +295,16 @@ spawn(char *file, char *arg, char *dir, int notify)
        if (pid == 0) {
                if (dir != NULL)
                        status = chdir(dir);
-               if (notify)
+               if (flag == 1)
                        fprintf(stdout, "\n +-++-++-+\n | n n n |\n +-++-++-+\n\n");
                execlp(file, file, arg, NULL);
                _exit(1);
        } else {
-               /* Ignore interruptions */
-               while (waitpid(pid, &status, 0) == -1)
-                       DPRINTF_D(status);
+               if (flag != 2) {
+                       /* Ignore interruptions */
+                       while (waitpid(pid, &status, 0) == -1)
+                               DPRINTF_D(status);
+               }
                DPRINTF_D(pid);
        }
 }
@@ -937,8 +944,8 @@ show_help(void)
     c                           Show change dir prompt\n\
     d                           Toggle detail view\n\
     D                           Toggle current file details screen\n\
-    m                           Show concise mediainfo in less\n\
-    M                           Show full mediainfo in less\n\
+    m                           Show concise mediainfo\n\
+    M                           Show full mediainfo\n\
     .                           Toggle hide .dot files\n\
     s                           Toggle sort by file size\n\
     S                           Toggle disk usage analyzer mode\n\
@@ -1618,9 +1625,7 @@ nochange:
                                goto nochange;
                        }
 
-                       exitcurses();
-                       spawn(desktop_manager, path, path, 0);
-                       initcurses();
+                       spawn(desktop_manager, path, path, 2);
                        break;
                case SEL_FSIZE:
                        sizeorder = !sizeorder;