static int set_sort_flags(int r);
static void statusbar(char *path);
#ifndef NOFIFO
-static void notify_fifo(bool force);
+static void notify_fifo(bool force, bool closepreview);
#endif
/* Functions */
} else {
#ifndef NOFIFO
if (!g_state.fifomode)
- notify_fifo(TRUE); /* Send hovered path to NNN_FIFO */
+ notify_fifo(TRUE, FALSE); /* Send hovered path to NNN_FIFO */
#endif
escaped = TRUE;
settimeout();
}
#ifndef NOFIFO
-static void notify_fifo(bool force)
+static void notify_fifo(bool force, bool closepreview)
{
if (!fifopath)
return;
}
}
+ if (closepreview) {
+ if (write(fifofd, "close\n", 6) != 6)
+ xerror();
+ return;
+ }
+
static struct entry lastentry;
if (!force && !memcmp(&lastentry, &pdents[cur], sizeof(struct entry)))
#ifndef NOFIFO
if (!g_state.fifomode)
- notify_fifo(FALSE); /* Send hovered path to NNN_FIFO */
+ notify_fifo(FALSE, FALSE); /* Send hovered path to NNN_FIFO */
#endif
}
move_cursor(r, 1);
#ifndef NOFIFO
else if ((event.bstate == BUTTON1_PRESSED) && !g_state.fifomode)
- notify_fifo(TRUE); /* Send clicked path to NNN_FIFO */
+ notify_fifo(TRUE, FALSE); /* Send clicked path to NNN_FIFO */
#endif
/* Handle right click selection */
if (event.bstate == BUTTON3_PRESSED) {
}
#ifndef NOFIFO
if (g_state.fifomode && (sel == SEL_OPEN)) {
- notify_fifo(TRUE); /* Send opened path to NNN_FIFO */
+ notify_fifo(TRUE, FALSE); /* Send opened path to NNN_FIFO */
goto nochange;
}
#endif
&& strstr(g_buf, "text")
#endif
) {
+#ifndef NOFIFO
+ notify_fifo(FALSE, TRUE);
+#endif
spawn(editor, newpath, NULL, NULL, F_CLI);
if (cfg.filtermode) {
presel = FILTER;
}
/* Invoke desktop opener as last resort */
+#ifndef NOFIFO
+ notify_fifo(FALSE, TRUE);
+#endif
spawn(opener, newpath, NULL, NULL, opener_flags);
/* Move cursor to the next entry if not the last entry */
copycurname();
goto nochange;
case SEL_EDIT:
+#ifndef NOFIFO
+ notify_fifo(FALSE, TRUE);
+#endif
spawn(editor, newpath, NULL, NULL, F_CLI);
continue;
default: /* SEL_LOCK */
#ifndef NOFIFO
if (!g_state.fifomode)
- notify_fifo(FALSE);
+ notify_fifo(FALSE, FALSE);
if (fifofd != -1)
close(fifofd);
#endif