Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Arun Prakash Jana 2016-10-05 20:41:32 +05:30
commit 596da965cf
3 changed files with 17 additions and 12 deletions

View file

@ -1,4 +1,4 @@
VERSION = 0.5 VERSION = 0.6
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = $(PREFIX)/man MANPREFIX = $(PREFIX)/man
@ -16,7 +16,7 @@ BIN = noice
all: $(BIN) all: $(BIN)
$(BIN): $(OBJ) $(BIN): $(OBJ)
$(CC) $(CFLAGS) -o $@ $(OBJ) $(LDLIBS) $(CC) $(CFLAGS) -o $@ $(OBJ) $(LDFLAGS) $(LDLIBS)
noice.o: util.h config.h noice.o: util.h config.h
strlcat.o: util.h strlcat.o: util.h

View file

@ -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[] = {

16
noice.c
View file

@ -256,6 +256,12 @@ setfilter(regex_t *regex, char *filter)
return r; return r;
} }
void
initfilter(int dot, char **ifilter)
{
*ifilter = dot ? "." : "^[^.]";
}
int int
visible(regex_t *regex, char *file) visible(regex_t *regex, char *file)
{ {
@ -793,10 +799,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;
initfilter(showhidden, &ifilter);
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;
@ -855,9 +860,8 @@ main(int argc, char *argv[])
} }
if (getuid() == 0) if (getuid() == 0)
ifilter = "."; showhidden = 1;
else initfilter(showhidden, &ifilter);
ifilter = "^[^.]"; /* Hide dotfiles */
if (argv[1] != NULL) { if (argv[1] != NULL) {
ipath = argv[1]; ipath = argv[1];