]> Sergey Matveev's repositories - nnn.git/commitdiff
GUI app launcher mode with 'o'.
authorArun Prakash Jana <engineerarun@gmail.com>
Thu, 8 Nov 2018 01:36:09 +0000 (07:06 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Thu, 8 Nov 2018 01:36:09 +0000 (07:06 +0530)
Removed file manager and desktop search keys.
Both can be launched with launcher key.

README.md
nnn.1
nnn.c
nnn.h

index 0ae23d4e8407b549e86d8f808a816762098304c9..de27487744402f602bfc4050c5889948327ae71b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -91,7 +91,6 @@ Have fun with it! Missing a feature? Want to contribute? Head to the rolling [To
   - Numeric order (1, 2, ... 10, 11, ...) for numeric names
 - Search
   - Superfast directory content filtering with *search-as-you-type*
-  - Desktop search (gnome-search-tool, catfish) integration
 - Mimes
   - Open with desktop opener (default) or specify a custom app
   - Create, list and extract archives (needs atool/patool)
@@ -108,7 +107,7 @@ Have fun with it! Missing a feature? Want to contribute? Head to the rolling [To
   - Copy absolute file paths with quotes
   - 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
+  - GUI app launcher
   - Terminal screensaver/locker integration
 - Unicode support
 - Highly optimized code, minimal resource usage
@@ -250,8 +249,7 @@ optional args:
              ^L  Redraw, clear prompt
             Esc  Exit prompt
               L  Lock terminal
-              o  Open DE filemanager
-             ^/  Open DE search app
+              o  Launch GUI app
               ?  Help, settings
           Q, ^G  Quit and cd
           q, ^X  Quit
@@ -304,7 +302,6 @@ The following indicators are used in the detail view:
 | --- | --- |
 | xdg-open (Linux), open(1) (OS X), cygstart (Cygwin) | desktop opener |
 | mediainfo, exiftool | multimedia file details |
-| 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), bashlock (OS X), lock(1) (BSD) | terminal locker |
@@ -315,12 +312,8 @@ The following indicators are used in the detail view:
 - To edit all text files in EDITOR (preferably CLI, fallback vi):
 
       export NNN_USE_EDITOR=1
-- To enable the desktop file manager key, set `NNN_DE_FILE_MANAGER`. E.g.:
 
-      export NNN_DE_FILE_MANAGER=thunar
-      export NNN_DE_FILE_MANAGER=nautilus
-
-Customizable script [nlay](https://github.com/jarun/nnn/wiki/all-about-nlay) is used to run desktop search utility and terminal locker.
+Customizable script [nlay](https://github.com/jarun/nnn/wiki/all-about-nlay) is used to run terminal locker.
 
 #### Help
 
diff --git a/nnn.1 b/nnn.1
index e8849847122573edcc4483c71abd8e4f10209d00..73183d34390252c0e6610cd054eb9875fe5366b9 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -57,8 +57,6 @@ Change to initial directory
 Change to the last visited directory
 .It Ic /
 Change filter (more information below)
-.It Ic ^/
-Search directory in desktop search tool
 .It Ic \&.
 Toggle show hidden . (dot) files
 .It Ic ^B
@@ -95,8 +93,6 @@ Spawn SHELL in PWD (fallback sh)
 Run a custom script
 .It Ic e
 Open current entry in EDITOR (fallback vi)
-.It Ic o
-Open directory in NNN_DE_FILE_MANAGER
 .It Ic p
 Open current entry in PAGER (fallback less)
 .It Ic f
@@ -119,6 +115,8 @@ Force a redraw, clear prompt
 Exit prompt
 .It Ic L
 Lock terminal (Linux only)
+.It Ic o
+Launch a GUI application
 .It Ic \&?
 Toggle help and settings screen
 .It Ic Q, ^G
@@ -240,12 +238,6 @@ files.
     export NNN_USE_EDITOR=1
 .Ed
 .Pp
-\fBNNN_DE_FILE_MANAGER:\fR set to a desktop file manager to open the current
-directory with. E.g.:
-.Bd -literal
-    export NNN_DE_FILE_MANAGER=thunar
-.Ed
-.Pp
 \fBNNN_IDLE_TIMEOUT:\fR set idle timeout (in seconds) to invoke terminal
 screensaver.
 .Pp
diff --git a/nnn.c b/nnn.c
index cdbe764dee19999356fbd81c46b73f00abc8043f..f03abb071dfbf8a2eb8ffeb496a7ed34655ca38f 100644 (file)
--- a/nnn.c
+++ b/nnn.c
@@ -269,7 +269,6 @@ static uint idletimeout, copybufpos, copybuflen;
 static char *player;
 static char *copier;
 static char *editor;
-static char *dmanager; /* desktop file manager */
 static blkcnt_t ent_blocks;
 static blkcnt_t dir_blocks;
 static ulong num_files;
@@ -1972,8 +1971,7 @@ static int show_help(char *path)
            "d^L  Redraw, clear prompt\n"
           "cEsc  Exit prompt\n"
             "eL  Lock terminal\n"
-            "eo  Open DE filemanager\n"
-           "d^/  Open DE search app\n"
+            "eo  Launch GUI app\n"
             "e?  Help, settings\n"
         "aQ, ^G  Quit and cd\n"
         "aq, ^X  Quit\n\n"};
@@ -2010,8 +2008,6 @@ static int show_help(char *path)
 
        if (editor)
                dprintf(fd, "NNN_USE_EDITOR: %s\n", editor);
-       if (dmanager)
-               dprintf(fd, "NNN_DE_FILE_MANAGER: %s\n", dmanager);
        if (idletimeout)
                dprintf(fd, "NNN_IDLE_TIMEOUT: %d secs\n", idletimeout);
        if (copier)
@@ -2759,9 +2755,6 @@ nochange:
                                goto begin;
                        }
                        goto nochange;
-               case SEL_SEARCH:
-                       spawn(player, path, "search", NULL, F_NORMAL);
-                       break;
                case SEL_TOGGLEDOT:
                        cfg.showhidden ^= 1;
                        initfilter(cfg.showhidden, &ifilter);
@@ -2828,14 +2821,6 @@ nochange:
                                goto begin;
                        }
                        break;
-               case SEL_DFB:
-                       if (!dmanager) {
-                               printmsg("set NNN_DE_FILE_MANAGER");
-                               goto nochange;
-                       }
-
-                       spawn(dmanager, path, NULL, path, F_NOWAIT | F_NOTRACE);
-                       break;
                case SEL_FSIZE:
                        cfg.sizeorder ^= 1;
                        cfg.mtimeorder = 0;
@@ -2984,9 +2969,12 @@ nochange:
                case SEL_ARCHIVE:
                        if (!ndents)
                                break; // fallthrough
+               case SEL_LAUNCH: // fallthrough
                case SEL_NEW:
                        if (sel == SEL_OPEN)
                                tmp = xreadline(NULL, "open with: ");
+                       else if (sel == SEL_LAUNCH)
+                               tmp = xreadline(NULL, "launch: ");
                        else if (sel == SEL_ARCHIVE)
                                tmp = xreadline(dents[cur].name, "name: ");
                        else
@@ -3016,6 +3004,11 @@ nochange:
                                continue;
                        }
 
+                       if (sel == SEL_LAUNCH) {
+                               spawn(tmp, NULL, NULL, path, F_NOWAIT | F_NOTRACE);
+                               break;
+                       }
+
                        if (sel == SEL_ARCHIVE) {
                                /* newpath is used as temporary buffer */
                                if (!get_output(newpath, PATH_MAX, "which", utils[APACK], NULL, 0)) {
@@ -3345,9 +3338,6 @@ int main(int argc, char *argv[])
        if (!player)
                player = utils[NLAY];
 
-       /* Get the desktop file manager, if set */
-       dmanager = getenv("NNN_DE_FILE_MANAGER");
-
        /* Get screensaver wait time, if set; copier used as tmp var */
        copier = getenv("NNN_IDLE_TIMEOUT");
        if (copier) {
diff --git a/nnn.h b/nnn.h
index 93a390f16ac311f31c16b0d8515df969cf5114ef..39d21d53efb4e6a5d1f55e4b66a941878cc86193 100644 (file)
--- a/nnn.h
+++ b/nnn.h
@@ -52,13 +52,12 @@ enum action {
        SEL_VISIT,
        SEL_FLTR,
        SEL_MFLTR,
-       SEL_SEARCH,
        SEL_TOGGLEDOT,
        SEL_DETAIL,
        SEL_STATS,
        SEL_MEDIA,
        SEL_FMEDIA,
-       SEL_DFB,
+       SEL_LAUNCH,
        SEL_ARCHIVE,
        SEL_LIST,
        SEL_EXTRACT,
@@ -156,8 +155,6 @@ static struct key bindings[] = {
        /* Toggle filter mode */
        { KEY_IC,         SEL_MFLTR,     "",     "" },
        { CONTROL('I'),   SEL_MFLTR,     "",     "" },
-       /* Desktop search */
-       { CONTROL('_'),   SEL_SEARCH,    "",     "" },
        /* Toggle hide .dot files */
        { '.',            SEL_TOGGLEDOT, "",     "" },
        /* Detailed listing */
@@ -168,8 +165,8 @@ static struct key bindings[] = {
        { 'm',            SEL_MEDIA,     NULL,   "" },
        /* Show media info full, run is hacked */
        { 'M',            SEL_FMEDIA,    "-f",   "" },
-       /* Open dir in desktop file manager */
-       { 'o',            SEL_DFB,       "",     "" },
+       /* Launch a GUI application */
+       { 'o',            SEL_LAUNCH,    "",     "" },
        /* Create archive */
        { 'f',            SEL_ARCHIVE,   "",     "" },
        /* List archive */