GUI app launcher mode with 'o'.

Removed file manager and desktop search keys.
Both can be launched with launcher key.
This commit is contained in:
Arun Prakash Jana 2018-11-08 07:06:09 +05:30
parent 23acdebf44
commit 99a9d63ee7
No known key found for this signature in database
GPG key ID: A75979F35C080412
4 changed files with 17 additions and 45 deletions

View file

@ -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

12
nnn.1
View file

@ -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

28
nnn.c
View file

@ -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) {

9
nnn.h
View file

@ -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 */