mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Make toggle dot behaviour persistent
Once set, the default filter is updated. This means that toggle dot will also work as expected when noice is executed as root. Based on discussion with Ypnose.
This commit is contained in:
parent
bd79c29d8b
commit
dd29e81df5
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
int mtimeorder = 0; /* Set to 1 to sort by time modified */
|
int mtimeorder = 0; /* Set to 1 to sort by time modified */
|
||||||
int idletimeout = 0; /* Screensaver timeout in seconds, 0 to disable */
|
int idletimeout = 0; /* Screensaver timeout in seconds, 0 to disable */
|
||||||
|
int showhidden = 0; /* Set to 1 to show hidden files by default */
|
||||||
char *idlecmd = "rain"; /* The screensaver program */
|
char *idlecmd = "rain"; /* The screensaver program */
|
||||||
|
|
||||||
struct assoc assocs[] = {
|
struct assoc assocs[] = {
|
||||||
|
|
10
noice.c
10
noice.c
|
@ -733,10 +733,9 @@ nochange:
|
||||||
DPRINTF_S(path);
|
DPRINTF_S(path);
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_TOGGLEDOT:
|
case SEL_TOGGLEDOT:
|
||||||
if (strcmp(fltr, ifilter) != 0)
|
showhidden ^= 1;
|
||||||
|
ifilter = showhidden ? "." : "^[^.]";
|
||||||
strlcpy(fltr, ifilter, sizeof(fltr));
|
strlcpy(fltr, ifilter, sizeof(fltr));
|
||||||
else
|
|
||||||
strlcpy(fltr, ".", sizeof(fltr));
|
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_MTIME:
|
case SEL_MTIME:
|
||||||
mtimeorder = !mtimeorder;
|
mtimeorder = !mtimeorder;
|
||||||
|
@ -795,9 +794,12 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getuid() == 0)
|
if (getuid() == 0)
|
||||||
|
showhidden = 1;
|
||||||
|
|
||||||
|
if (showhidden)
|
||||||
ifilter = ".";
|
ifilter = ".";
|
||||||
else
|
else
|
||||||
ifilter = "^[^.]"; /* Hide dotfiles */
|
ifilter = "^[^.]";
|
||||||
|
|
||||||
if (argv[1] != NULL) {
|
if (argv[1] != NULL) {
|
||||||
ipath = argv[1];
|
ipath = argv[1];
|
||||||
|
|
Loading…
Reference in a new issue