mirror of
https://github.com/jarun/nnn.git
synced 2025-03-01 20:39:20 +00:00
Restore screensaver mode
Disable timeout when in filter or type mode.
This commit is contained in:
parent
ebaa637b0b
commit
756b50be27
2 changed files with 19 additions and 0 deletions
|
@ -3,6 +3,8 @@
|
||||||
#define EMPTY " "
|
#define EMPTY " "
|
||||||
|
|
||||||
int mtimeorder = 0; /* Set to 1 to sort by time in the default case */
|
int mtimeorder = 0; /* Set to 1 to sort by time in the default case */
|
||||||
|
int idletimeout = 0; /* Screensaver timeout in seconds, 0 to disable */
|
||||||
|
char *idlecmd = "rain"; /* The screensaver program */
|
||||||
|
|
||||||
struct assoc assocs[] = {
|
struct assoc assocs[] = {
|
||||||
{ "\\.(avi|mp4|mkv|mp3|ogg|flac|mov)$", "mplayer" },
|
{ "\\.(avi|mp4|mkv|mp3|ogg|flac|mov)$", "mplayer" },
|
||||||
|
|
17
noice.c
17
noice.c
|
@ -82,6 +82,7 @@ struct entry *dents;
|
||||||
int n, cur;
|
int n, cur;
|
||||||
char *path, *oldpath;
|
char *path, *oldpath;
|
||||||
char *fltr;
|
char *fltr;
|
||||||
|
int idle;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Layout:
|
* Layout:
|
||||||
|
@ -259,6 +260,7 @@ initcurses(void)
|
||||||
intrflush(stdscr, FALSE);
|
intrflush(stdscr, FALSE);
|
||||||
keypad(stdscr, TRUE);
|
keypad(stdscr, TRUE);
|
||||||
curs_set(FALSE); /* Hide cursor */
|
curs_set(FALSE); /* Hide cursor */
|
||||||
|
timeout(1000); /* One second */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -314,6 +316,10 @@ nextsel(char **run)
|
||||||
int c, i;
|
int c, i;
|
||||||
|
|
||||||
c = getch();
|
c = getch();
|
||||||
|
if (c == -1)
|
||||||
|
idle++;
|
||||||
|
else
|
||||||
|
idle = 0;
|
||||||
|
|
||||||
for (i = 0; i < LEN(bindings); i++)
|
for (i = 0; i < LEN(bindings); i++)
|
||||||
if (c == bindings[i].sym) {
|
if (c == bindings[i].sym) {
|
||||||
|
@ -329,12 +335,14 @@ readln(void)
|
||||||
{
|
{
|
||||||
char ln[LINE_MAX];
|
char ln[LINE_MAX];
|
||||||
|
|
||||||
|
timeout(-1);
|
||||||
echo();
|
echo();
|
||||||
curs_set(TRUE);
|
curs_set(TRUE);
|
||||||
memset(ln, 0, sizeof(ln));
|
memset(ln, 0, sizeof(ln));
|
||||||
wgetnstr(stdscr, ln, sizeof(ln) - 1);
|
wgetnstr(stdscr, ln, sizeof(ln) - 1);
|
||||||
noecho();
|
noecho();
|
||||||
curs_set(FALSE);
|
curs_set(FALSE);
|
||||||
|
timeout(1000);
|
||||||
return strlen(ln) ? strdup(ln) : NULL;
|
return strlen(ln) ? strdup(ln) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,6 +357,7 @@ readmore(char **str)
|
||||||
int i;
|
int i;
|
||||||
char *ln = *str;
|
char *ln = *str;
|
||||||
|
|
||||||
|
timeout(-1);
|
||||||
if (ln != NULL)
|
if (ln != NULL)
|
||||||
i = strlen(ln);
|
i = strlen(ln);
|
||||||
else
|
else
|
||||||
|
@ -384,6 +393,7 @@ readmore(char **str)
|
||||||
curs_set(FALSE);
|
curs_set(FALSE);
|
||||||
|
|
||||||
*str = ln;
|
*str = ln;
|
||||||
|
timeout(1000);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -842,6 +852,13 @@ moretyping:
|
||||||
initcurses();
|
initcurses();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* Screensaver */
|
||||||
|
if (idletimeout != 0 && idle == idletimeout) {
|
||||||
|
idle = 0;
|
||||||
|
exitcurses();
|
||||||
|
spawn(idlecmd, NULL, NULL);
|
||||||
|
initcurses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue