- Detailed file information
- Media information (using plugin)
- Convenience
- - Notification on cp, mv, rm completion (needs ntfy)
- Run plugins and commands with custom keybinds
- FreeDesktop compliant trash (needs trash-cli)
- Cross-dir file/all/range selection
- Batch renamer (feature-limited) for selection or dir
- Copy (as), move (as), delete, archive, link selection
+ - Notification on cp, mv, rm completion
- Create (with parents), rename, duplicate (anywhere) files and dirs
- Launch GUI apps, run commands, execute file, spawn a shell
- Hovered file set as `$nnn` at prompt and spawned shell
| archivemount, fusermount(3) | optional | mount, unmount archives |
| sshfs, [rclone](https://rclone.org/), fusermount(3) | optional | mount, unmount remotes |
| trash-cli | optional | trash files (default action: rm) |
-| [ntfy](https://github.com/dschep/ntfy) | optional | operation completion notification |
| vlock (Linux), bashlock (macOS), lock(1) (BSD) | optional | terminal locker (fallback: [cmatrix](https://github.com/abishekvashok/cmatrix)) |
| advcpmv (Linux) ([integration](https://github.com/jarun/nnn/wiki/Advanced-use-cases#show-cp-mv-progress)) | optional | copy, move progress |
| `$VISUAL` (else `$EDITOR`), `$PAGER`, `$SHELL` | optional | fallback vi, less, sh |
--- /dev/null
+#!/usr/bin/env sh
+
+# Description: Show a notification
+#
+# Details: nnn invokes this plugin to show notification when a cp/mv/rm operation is complete.
+#
+# Requires: notify-send (Ubuntu)/ntfy (https://github.com/dschep/ntfy)/osascript (macOS)
+#
+# Shell: POSIX compliant
+# Author: Anna Arad
+
+OS="$(uname)"
+
+if which notify-send >/dev/null 2>&1; then
+ notify-send nnn "Done!"
+elif [ "$OS" = "Darwin" ]; then
+ osascript -e 'display notification "Done!" with title "nnn"'
+elif which ntfy >/dev/null 2>&1; then
+ ntfy -t nnn send "Done!"
+fi
#define CTX_MAX 4
#define DOT_FILTER_LEN 7
#define ASCII_MAX 128
-#define EXEC_ARGS_MAX 10
+#define EXEC_ARGS_MAX 8
#define SCROLLOFF 3
#define MIN_DISPLAY_COLS 10
#define LONG_SIZE sizeof(ulong)
#define UTIL_SH 14
#define UTIL_FZF 15
#define UTIL_FZY 16
+#define UTIL_NOTIFY 17
/* Utilities to open files, run actions */
static char * const utils[] = {
"sh",
"fzf",
"fzy",
+ ".notify",
};
/* Common strings */
/* If open file is disabled on right arrow or `l`, return */
if (cfg.nonavopen && sel == SEL_NAV_IN)
- continue;
+ goto nochange;
/* Handle plugin selection mode */
if (cfg.runplugin) {
if (!cpmvrm_selection(sel, path, &presel))
goto nochange;
- spawn("ntfy -l CRITICAL -t nnn send Done!",
- NULL, NULL, NULL, F_NOWAIT | F_NOTRACE | F_MULTI);
+ /* Show notification on operation complete */
+ mkpath(plugindir, utils[UTIL_NOTIFY], newpath);
+ spawn(newpath, NULL, NULL, NULL, F_NOWAIT | F_NOTRACE);
if (ndents)
copycurname();