mirror of
https://github.com/jarun/nnn.git
synced 2025-03-18 20:39:45 +00:00
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:
parent
23acdebf44
commit
99a9d63ee7
4 changed files with 17 additions and 45 deletions
13
README.md
13
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
|
- Numeric order (1, 2, ... 10, 11, ...) for numeric names
|
||||||
- Search
|
- Search
|
||||||
- Superfast directory content filtering with *search-as-you-type*
|
- Superfast directory content filtering with *search-as-you-type*
|
||||||
- Desktop search (gnome-search-tool, catfish) integration
|
|
||||||
- Mimes
|
- Mimes
|
||||||
- Open with desktop opener (default) or specify a custom app
|
- Open with desktop opener (default) or specify a custom app
|
||||||
- Create, list and extract archives (needs atool/patool)
|
- 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
|
- Copy absolute file paths with quotes
|
||||||
- Change directory at exit (*easy* shell integration)
|
- Change directory at exit (*easy* shell integration)
|
||||||
- Open any file in EDITOR (fallback vi) or PAGER (fallback less)
|
- 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
|
- Terminal screensaver/locker integration
|
||||||
- Unicode support
|
- Unicode support
|
||||||
- Highly optimized code, minimal resource usage
|
- Highly optimized code, minimal resource usage
|
||||||
|
@ -250,8 +249,7 @@ optional args:
|
||||||
^L Redraw, clear prompt
|
^L Redraw, clear prompt
|
||||||
Esc Exit prompt
|
Esc Exit prompt
|
||||||
L Lock terminal
|
L Lock terminal
|
||||||
o Open DE filemanager
|
o Launch GUI app
|
||||||
^/ Open DE search app
|
|
||||||
? Help, settings
|
? Help, settings
|
||||||
Q, ^G Quit and cd
|
Q, ^G Quit and cd
|
||||||
q, ^X Quit
|
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 |
|
| xdg-open (Linux), open(1) (OS X), cygstart (Cygwin) | desktop opener |
|
||||||
| mediainfo, exiftool | multimedia file details |
|
| mediainfo, exiftool | multimedia file details |
|
||||||
| gnome-search-tool, catfish | desktop search utility |
|
|
||||||
| atool, patool ([integration](#integrate-patool)) | create, list and extract archives |
|
| atool, patool ([integration](#integrate-patool)) | create, list and extract archives |
|
||||||
| vidir from moreutils | batch rename, move, delete dir entries |
|
| vidir from moreutils | batch rename, move, delete dir entries |
|
||||||
| vlock (Linux), bashlock (OS X), lock(1) (BSD) | terminal locker |
|
| 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):
|
- To edit all text files in EDITOR (preferably CLI, fallback vi):
|
||||||
|
|
||||||
export NNN_USE_EDITOR=1
|
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
|
Customizable script [nlay](https://github.com/jarun/nnn/wiki/all-about-nlay) is used to run terminal locker.
|
||||||
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.
|
|
||||||
|
|
||||||
#### Help
|
#### Help
|
||||||
|
|
||||||
|
|
12
nnn.1
12
nnn.1
|
@ -57,8 +57,6 @@ Change to initial directory
|
||||||
Change to the last visited directory
|
Change to the last visited directory
|
||||||
.It Ic /
|
.It Ic /
|
||||||
Change filter (more information below)
|
Change filter (more information below)
|
||||||
.It Ic ^/
|
|
||||||
Search directory in desktop search tool
|
|
||||||
.It Ic \&.
|
.It Ic \&.
|
||||||
Toggle show hidden . (dot) files
|
Toggle show hidden . (dot) files
|
||||||
.It Ic ^B
|
.It Ic ^B
|
||||||
|
@ -95,8 +93,6 @@ Spawn SHELL in PWD (fallback sh)
|
||||||
Run a custom script
|
Run a custom script
|
||||||
.It Ic e
|
.It Ic e
|
||||||
Open current entry in EDITOR (fallback vi)
|
Open current entry in EDITOR (fallback vi)
|
||||||
.It Ic o
|
|
||||||
Open directory in NNN_DE_FILE_MANAGER
|
|
||||||
.It Ic p
|
.It Ic p
|
||||||
Open current entry in PAGER (fallback less)
|
Open current entry in PAGER (fallback less)
|
||||||
.It Ic f
|
.It Ic f
|
||||||
|
@ -119,6 +115,8 @@ Force a redraw, clear prompt
|
||||||
Exit prompt
|
Exit prompt
|
||||||
.It Ic L
|
.It Ic L
|
||||||
Lock terminal (Linux only)
|
Lock terminal (Linux only)
|
||||||
|
.It Ic o
|
||||||
|
Launch a GUI application
|
||||||
.It Ic \&?
|
.It Ic \&?
|
||||||
Toggle help and settings screen
|
Toggle help and settings screen
|
||||||
.It Ic Q, ^G
|
.It Ic Q, ^G
|
||||||
|
@ -240,12 +238,6 @@ files.
|
||||||
export NNN_USE_EDITOR=1
|
export NNN_USE_EDITOR=1
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.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
|
\fBNNN_IDLE_TIMEOUT:\fR set idle timeout (in seconds) to invoke terminal
|
||||||
screensaver.
|
screensaver.
|
||||||
.Pp
|
.Pp
|
||||||
|
|
28
nnn.c
28
nnn.c
|
@ -269,7 +269,6 @@ static uint idletimeout, copybufpos, copybuflen;
|
||||||
static char *player;
|
static char *player;
|
||||||
static char *copier;
|
static char *copier;
|
||||||
static char *editor;
|
static char *editor;
|
||||||
static char *dmanager; /* desktop file manager */
|
|
||||||
static blkcnt_t ent_blocks;
|
static blkcnt_t ent_blocks;
|
||||||
static blkcnt_t dir_blocks;
|
static blkcnt_t dir_blocks;
|
||||||
static ulong num_files;
|
static ulong num_files;
|
||||||
|
@ -1972,8 +1971,7 @@ static int show_help(char *path)
|
||||||
"d^L Redraw, clear prompt\n"
|
"d^L Redraw, clear prompt\n"
|
||||||
"cEsc Exit prompt\n"
|
"cEsc Exit prompt\n"
|
||||||
"eL Lock terminal\n"
|
"eL Lock terminal\n"
|
||||||
"eo Open DE filemanager\n"
|
"eo Launch GUI app\n"
|
||||||
"d^/ Open DE search app\n"
|
|
||||||
"e? Help, settings\n"
|
"e? Help, settings\n"
|
||||||
"aQ, ^G Quit and cd\n"
|
"aQ, ^G Quit and cd\n"
|
||||||
"aq, ^X Quit\n\n"};
|
"aq, ^X Quit\n\n"};
|
||||||
|
@ -2010,8 +2008,6 @@ static int show_help(char *path)
|
||||||
|
|
||||||
if (editor)
|
if (editor)
|
||||||
dprintf(fd, "NNN_USE_EDITOR: %s\n", editor);
|
dprintf(fd, "NNN_USE_EDITOR: %s\n", editor);
|
||||||
if (dmanager)
|
|
||||||
dprintf(fd, "NNN_DE_FILE_MANAGER: %s\n", dmanager);
|
|
||||||
if (idletimeout)
|
if (idletimeout)
|
||||||
dprintf(fd, "NNN_IDLE_TIMEOUT: %d secs\n", idletimeout);
|
dprintf(fd, "NNN_IDLE_TIMEOUT: %d secs\n", idletimeout);
|
||||||
if (copier)
|
if (copier)
|
||||||
|
@ -2759,9 +2755,6 @@ nochange:
|
||||||
goto begin;
|
goto begin;
|
||||||
}
|
}
|
||||||
goto nochange;
|
goto nochange;
|
||||||
case SEL_SEARCH:
|
|
||||||
spawn(player, path, "search", NULL, F_NORMAL);
|
|
||||||
break;
|
|
||||||
case SEL_TOGGLEDOT:
|
case SEL_TOGGLEDOT:
|
||||||
cfg.showhidden ^= 1;
|
cfg.showhidden ^= 1;
|
||||||
initfilter(cfg.showhidden, &ifilter);
|
initfilter(cfg.showhidden, &ifilter);
|
||||||
|
@ -2828,14 +2821,6 @@ nochange:
|
||||||
goto begin;
|
goto begin;
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case SEL_FSIZE:
|
||||||
cfg.sizeorder ^= 1;
|
cfg.sizeorder ^= 1;
|
||||||
cfg.mtimeorder = 0;
|
cfg.mtimeorder = 0;
|
||||||
|
@ -2984,9 +2969,12 @@ nochange:
|
||||||
case SEL_ARCHIVE:
|
case SEL_ARCHIVE:
|
||||||
if (!ndents)
|
if (!ndents)
|
||||||
break; // fallthrough
|
break; // fallthrough
|
||||||
|
case SEL_LAUNCH: // fallthrough
|
||||||
case SEL_NEW:
|
case SEL_NEW:
|
||||||
if (sel == SEL_OPEN)
|
if (sel == SEL_OPEN)
|
||||||
tmp = xreadline(NULL, "open with: ");
|
tmp = xreadline(NULL, "open with: ");
|
||||||
|
else if (sel == SEL_LAUNCH)
|
||||||
|
tmp = xreadline(NULL, "launch: ");
|
||||||
else if (sel == SEL_ARCHIVE)
|
else if (sel == SEL_ARCHIVE)
|
||||||
tmp = xreadline(dents[cur].name, "name: ");
|
tmp = xreadline(dents[cur].name, "name: ");
|
||||||
else
|
else
|
||||||
|
@ -3016,6 +3004,11 @@ nochange:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sel == SEL_LAUNCH) {
|
||||||
|
spawn(tmp, NULL, NULL, path, F_NOWAIT | F_NOTRACE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (sel == SEL_ARCHIVE) {
|
if (sel == SEL_ARCHIVE) {
|
||||||
/* newpath is used as temporary buffer */
|
/* newpath is used as temporary buffer */
|
||||||
if (!get_output(newpath, PATH_MAX, "which", utils[APACK], NULL, 0)) {
|
if (!get_output(newpath, PATH_MAX, "which", utils[APACK], NULL, 0)) {
|
||||||
|
@ -3345,9 +3338,6 @@ int main(int argc, char *argv[])
|
||||||
if (!player)
|
if (!player)
|
||||||
player = utils[NLAY];
|
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 */
|
/* Get screensaver wait time, if set; copier used as tmp var */
|
||||||
copier = getenv("NNN_IDLE_TIMEOUT");
|
copier = getenv("NNN_IDLE_TIMEOUT");
|
||||||
if (copier) {
|
if (copier) {
|
||||||
|
|
9
nnn.h
9
nnn.h
|
@ -52,13 +52,12 @@ enum action {
|
||||||
SEL_VISIT,
|
SEL_VISIT,
|
||||||
SEL_FLTR,
|
SEL_FLTR,
|
||||||
SEL_MFLTR,
|
SEL_MFLTR,
|
||||||
SEL_SEARCH,
|
|
||||||
SEL_TOGGLEDOT,
|
SEL_TOGGLEDOT,
|
||||||
SEL_DETAIL,
|
SEL_DETAIL,
|
||||||
SEL_STATS,
|
SEL_STATS,
|
||||||
SEL_MEDIA,
|
SEL_MEDIA,
|
||||||
SEL_FMEDIA,
|
SEL_FMEDIA,
|
||||||
SEL_DFB,
|
SEL_LAUNCH,
|
||||||
SEL_ARCHIVE,
|
SEL_ARCHIVE,
|
||||||
SEL_LIST,
|
SEL_LIST,
|
||||||
SEL_EXTRACT,
|
SEL_EXTRACT,
|
||||||
|
@ -156,8 +155,6 @@ static struct key bindings[] = {
|
||||||
/* Toggle filter mode */
|
/* Toggle filter mode */
|
||||||
{ KEY_IC, SEL_MFLTR, "", "" },
|
{ KEY_IC, SEL_MFLTR, "", "" },
|
||||||
{ CONTROL('I'), SEL_MFLTR, "", "" },
|
{ CONTROL('I'), SEL_MFLTR, "", "" },
|
||||||
/* Desktop search */
|
|
||||||
{ CONTROL('_'), SEL_SEARCH, "", "" },
|
|
||||||
/* Toggle hide .dot files */
|
/* Toggle hide .dot files */
|
||||||
{ '.', SEL_TOGGLEDOT, "", "" },
|
{ '.', SEL_TOGGLEDOT, "", "" },
|
||||||
/* Detailed listing */
|
/* Detailed listing */
|
||||||
|
@ -168,8 +165,8 @@ static struct key bindings[] = {
|
||||||
{ 'm', SEL_MEDIA, NULL, "" },
|
{ 'm', SEL_MEDIA, NULL, "" },
|
||||||
/* Show media info full, run is hacked */
|
/* Show media info full, run is hacked */
|
||||||
{ 'M', SEL_FMEDIA, "-f", "" },
|
{ 'M', SEL_FMEDIA, "-f", "" },
|
||||||
/* Open dir in desktop file manager */
|
/* Launch a GUI application */
|
||||||
{ 'o', SEL_DFB, "", "" },
|
{ 'o', SEL_LAUNCH, "", "" },
|
||||||
/* Create archive */
|
/* Create archive */
|
||||||
{ 'f', SEL_ARCHIVE, "", "" },
|
{ 'f', SEL_ARCHIVE, "", "" },
|
||||||
/* List archive */
|
/* List archive */
|
||||||
|
|
Loading…
Add table
Reference in a new issue