aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--config.def.h7
-rw-r--r--noice.c18
3 files changed, 17 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index b293e4f..6705c3a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = 0.5
+VERSION = 0.6
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/man
@@ -16,7 +16,7 @@ BIN = noice
all: $(BIN)
$(BIN): $(OBJ)
- $(CC) $(CFLAGS) -o $@ $(OBJ) $(LDLIBS)
+ $(CC) $(CFLAGS) -o $@ $(OBJ) $(LDFLAGS) $(LDLIBS)
noice.o: util.h config.h
strlcat.o: util.h
diff --git a/config.def.h b/config.def.h
index 663351a..bffc69d 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,11 +1,12 @@
/* See LICENSE file for copyright and license details. */
-#define CWD "cwd: "
+#define CWD "cwd: "
#define CURSR " > "
#define EMPTY " "
-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 */
-char *idlecmd = "rain"; /* The screensaver program */
+int showhidden = 0; /* Set to 1 to show hidden files by default */
+char *idlecmd = "rain"; /* The screensaver program */
struct assoc assocs[] = {
//{ "\\.(avi|mp4|mkv|mp3|ogg|flac|mov)$", "mpv" },
diff --git a/noice.c b/noice.c
index 0e3eca7..e9e4e65 100644
--- a/noice.c
+++ b/noice.c
@@ -256,6 +256,12 @@ setfilter(regex_t *regex, char *filter)
return r;
}
+void
+initfilter(int dot, char **ifilter)
+{
+ *ifilter = dot ? "." : "^[^.]";
+}
+
int
visible(regex_t *regex, char *file)
{
@@ -793,10 +799,9 @@ nochange:
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;
+ initfilter(showhidden, &ifilter);
+ strlcpy(fltr, ifilter, sizeof(fltr));
goto begin;
case SEL_MTIME:
mtimeorder = !mtimeorder;
@@ -855,9 +860,8 @@ main(int argc, char *argv[])
}
if (getuid() == 0)
- ifilter = ".";
- else
- ifilter = "^[^.]"; /* Hide dotfiles */
+ showhidden = 1;
+ initfilter(showhidden, &ifilter);
if (argv[1] != NULL) {
ipath = argv[1];