config.def.h | 1 + noice.c | 12 +++++++----- diff --git a/config.def.h b/config.def.h index ca757dfee9dacaeab6140b6883f8f0d735d8f570..343869386c319ede671598e2def58b23e9819115 100644 --- a/config.def.h +++ b/config.def.h @@ -5,6 +5,7 @@ #define EMPTY " " int mtimeorder = 0; /* Set to 1 to sort by time modified */ 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 */ struct assoc assocs[] = { diff --git a/noice.c b/noice.c index a588a55cede83b485cd0c2758cdca7b26cb275db..0d5627dfea0b8cdf7aade9215cd63802c42218c2 100644 --- a/noice.c +++ b/noice.c @@ -733,10 +733,9 @@ strlcpy(fltr, ifilter, sizeof(fltr)); DPRINTF_S(path); goto begin; case SEL_TOGGLEDOT: - if (strcmp(fltr, ifilter) != 0) - strlcpy(fltr, ifilter, sizeof(fltr)); - else - strlcpy(fltr, ".", sizeof(fltr)); + showhidden ^= 1; + ifilter = showhidden ? "." : "^[^.]"; + strlcpy(fltr, ifilter, sizeof(fltr)); goto begin; case SEL_MTIME: mtimeorder = !mtimeorder; @@ -795,9 +794,12 @@ exit(1); } if (getuid() == 0) + showhidden = 1; + + if (showhidden) ifilter = "."; else - ifilter = "^[^.]"; /* Hide dotfiles */ + ifilter = "^[^.]"; if (argv[1] != NULL) { ipath = argv[1];