From 2bed0dd175e573aca14c93b698a92989140008e0 Mon Sep 17 00:00:00 2001 From: sin Date: Mon, 22 Aug 2016 11:22:24 +0100 Subject: [PATCH 1/5] Accept user-defined LDFLAGS in Makefile Diff by Ypnose --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9035141..d49b6fb 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,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 From bd79c29d8b3f4605de38a034fd24cf847dfa5273 Mon Sep 17 00:00:00 2001 From: sin Date: Mon, 22 Aug 2016 11:23:47 +0100 Subject: [PATCH 2/5] Align fields in config.def.h Diff by Ypnose --- config.def.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config.def.h b/config.def.h index af9bcbb..ca757df 100644 --- a/config.def.h +++ b/config.def.h @@ -1,11 +1,11 @@ /* 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 */ +char *idlecmd = "rain"; /* The screensaver program */ struct assoc assocs[] = { { "\\.(avi|mp4|mkv|mp3|ogg|flac|mov)$", "mplayer" }, From dd29e81df5e3aa917bb89d13282c3ba38f458a3f Mon Sep 17 00:00:00 2001 From: sin Date: Mon, 22 Aug 2016 13:44:52 +0100 Subject: [PATCH 3/5] 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. --- config.def.h | 1 + noice.c | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config.def.h b/config.def.h index ca757df..3438693 100644 --- a/config.def.h +++ b/config.def.h @@ -5,6 +5,7 @@ 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 a588a55..0d5627d 100644 --- a/noice.c +++ b/noice.c @@ -733,10 +733,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; + ifilter = showhidden ? "." : "^[^.]"; + strlcpy(fltr, ifilter, sizeof(fltr)); goto begin; case SEL_MTIME: mtimeorder = !mtimeorder; @@ -795,9 +794,12 @@ main(int argc, char *argv[]) } if (getuid() == 0) + showhidden = 1; + + if (showhidden) ifilter = "."; else - ifilter = "^[^.]"; /* Hide dotfiles */ + ifilter = "^[^.]"; if (argv[1] != NULL) { ipath = argv[1]; From 45e6fafc4708b10314be3399814c0f07d4ab8e1c Mon Sep 17 00:00:00 2001 From: sin Date: Mon, 22 Aug 2016 14:10:14 +0100 Subject: [PATCH 4/5] Split out default filter initialization --- noice.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/noice.c b/noice.c index 0d5627d..2dc895d 100644 --- a/noice.c +++ b/noice.c @@ -238,6 +238,12 @@ setfilter(regex_t *regex, char *filter) return r; } +void +initfilter(int dot, char **ifilter) +{ + *ifilter = dot ? "." : "^[^.]"; +} + int visible(regex_t *regex, char *file) { @@ -734,7 +740,7 @@ nochange: goto begin; case SEL_TOGGLEDOT: showhidden ^= 1; - ifilter = showhidden ? "." : "^[^.]"; + initfilter(showhidden, &ifilter); strlcpy(fltr, ifilter, sizeof(fltr)); goto begin; case SEL_MTIME: @@ -795,11 +801,7 @@ main(int argc, char *argv[]) if (getuid() == 0) showhidden = 1; - - if (showhidden) - ifilter = "."; - else - ifilter = "^[^.]"; + initfilter(showhidden, &ifilter); if (argv[1] != NULL) { ipath = argv[1]; From e56e7d912b2ccff920db03d54834f554f3568e31 Mon Sep 17 00:00:00 2001 From: sin Date: Wed, 24 Aug 2016 10:47:25 +0100 Subject: [PATCH 5/5] Bump to 0.6 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d49b6fb..9c32568 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = 0.5 +VERSION = 0.6 PREFIX = /usr/local MANPREFIX = $(PREFIX)/man