- Run plugins and custom commands with hotkeys
- FreeDesktop compliant trash (needs trash-cli)
- Cross-dir file/all/range selection
- - Batch renamer (feature-limited) for selection or dir
+ - Batch renamer for selection or dir
- Display a list of files from stdin
- Copy (as), move (as), delete, archive, link selection
- Dir updates, notification on cp, mv, rm completion
#define UTIL_FZY 16
#define UTIL_NTFY 17
#define UTIL_CBCP 18
+#define UTIL_BATCHRENAME 19
/* Utilities to open files, run actions */
static char * const utils[] = {
"fzy",
".ntfy",
".cbcp",
+ "batchrename",
};
/* Common strings */
static inline bool getutil(char *util);
static size_t mkpath(const char *dir, const char *name, char *out);
static char *xgetenv(const char *name, char *fallback);
-static void plugscript(const char *plugin, char *newpath, uchar flags);
+static bool plugscript(const char *plugin, char *newpath, const char *path, uchar flags);
/* Functions */
return TRUE;
}
-static void plugscript(const char *plugin, char *newpath, uchar flags)
+static bool plugscript(const char *plugin, char *newpath, const char *path, uchar flags)
{
mkpath(plugindir, plugin, newpath);
- if (!access(newpath, X_OK))
- spawn(newpath, NULL, NULL, NULL, flags);
+ if (!access(newpath, X_OK)) {
+ spawn(newpath, NULL, NULL, path, flags);
+ return TRUE;
+ }
+
+ return FALSE;
}
static void launch_app(const char *path, char *newpath)
case SEL_RENAMEMUL:
endselection();
- if (!batch_rename(path)) {
+ if (!plugscript(utils[UTIL_BATCHRENAME], newpath, path, F_CLI)
+ && !batch_rename(path)) {
printwait(messages[MSG_FAILED], &presel);
goto nochange;
}
}
if (cfg.x11)
- plugscript(utils[UTIL_CBCP], newpath, F_NOWAIT | F_NOTRACE);
+ plugscript(utils[UTIL_CBCP], newpath, NULL, F_NOWAIT | F_NOTRACE);
if (!nselected)
unlink(selpath);
writesel(pselbuf, selbufpos - 1); /* Truncate NULL from end */
if (cfg.x11)
- plugscript(utils[UTIL_CBCP], newpath, F_NOWAIT | F_NOTRACE);
+ plugscript(utils[UTIL_CBCP], newpath, NULL, F_NOWAIT | F_NOTRACE);
continue;
case SEL_SELEDIT:
r = editselection();
printwait(messages[r], &presel);
} else {
if (cfg.x11)
- plugscript(utils[UTIL_CBCP], newpath, F_NOWAIT | F_NOTRACE);
+ plugscript(utils[UTIL_CBCP], newpath, NULL, F_NOWAIT | F_NOTRACE);
cfg.filtermode ? presel = FILTER : statusbar(path);
}
goto nochange;
/* Show notification on operation complete */
if (cfg.x11)
- plugscript(utils[UTIL_NTFY], newpath, F_NOWAIT | F_NOTRACE);
+ plugscript(utils[UTIL_NTFY], newpath, NULL, F_NOWAIT | F_NOTRACE);
if (ndents)
copycurname();