Explorar el Código

Restore screensaver mode

Disable timeout when in filter or type mode.
master
sin hace 9 años
padre
commit
756b50be27
Se han modificado 2 ficheros con 19 adiciones y 0 borrados
  1. +2
    -0
      config.def.h
  2. +17
    -0
      noice.c

+ 2
- 0
config.def.h Ver fichero

@@ -3,6 +3,8 @@
#define EMPTY " "

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[] = {
{ "\\.(avi|mp4|mkv|mp3|ogg|flac|mov)$", "mplayer" },


+ 17
- 0
noice.c Ver fichero

@@ -82,6 +82,7 @@ struct entry *dents;
int n, cur;
char *path, *oldpath;
char *fltr;
int idle;

/*
* Layout:
@@ -259,6 +260,7 @@ initcurses(void)
intrflush(stdscr, FALSE);
keypad(stdscr, TRUE);
curs_set(FALSE); /* Hide cursor */
timeout(1000); /* One second */
}

void
@@ -314,6 +316,10 @@ nextsel(char **run)
int c, i;

c = getch();
if (c == -1)
idle++;
else
idle = 0;

for (i = 0; i < LEN(bindings); i++)
if (c == bindings[i].sym) {
@@ -329,12 +335,14 @@ readln(void)
{
char ln[LINE_MAX];

timeout(-1);
echo();
curs_set(TRUE);
memset(ln, 0, sizeof(ln));
wgetnstr(stdscr, ln, sizeof(ln) - 1);
noecho();
curs_set(FALSE);
timeout(1000);
return strlen(ln) ? strdup(ln) : NULL;
}

@@ -349,6 +357,7 @@ readmore(char **str)
int i;
char *ln = *str;

timeout(-1);
if (ln != NULL)
i = strlen(ln);
else
@@ -384,6 +393,7 @@ readmore(char **str)
curs_set(FALSE);

*str = ln;
timeout(1000);

return ret;
}
@@ -842,6 +852,13 @@ moretyping:
initcurses();
break;
}
/* Screensaver */
if (idletimeout != 0 && idle == idletimeout) {
idle = 0;
exitcurses();
spawn(idlecmd, NULL, NULL);
initcurses();
}
}
}



Cargando…
Cancelar
Guardar