dwm-noxz

[fork] suckless dwm - personal fork
git clone https://noxz.tech/git/dwm-noxz.git
dwm-noxz

commit: 8f617a303511701adc70a509f2d092664de4822a
parent: 4adb5a21cd5c9e9bda117ee35a7cf3dfdb97db45
author: Chris Noxz <chris@noxz.tech>
date:   Sat, 10 Jun 2023 10:36:27 +0200
Remove unused rules function
Mconfig.def.h12+----
Mdwm.c55++------------------
2 files changed, 7 insertions(+), 60 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -5,7 +5,7 @@
 /* appearance */
 static unsigned int borderpx    = 2;        /* border pixel of windows */
 static unsigned int snap        = 32;       /* snap pixel */
-static unsigned int gap         = 10;       /* inner and outer gap between windows */
+static unsigned int gap         = 0;        /* inner and outer gap between windows */
 static int showbar              = 1;        /* 0 means no bar */
 static int topbar               = 1;        /* 0 means bottom bar */
 static int viewontag            = 1;
@@ -42,7 +42,7 @@ static char col_snobg[]         = COL_DEF;
 static char *colors[][4]        = {
 	/*                          fg          bg          border      float   */
 	[SchemeNorm]            = { col_none,   col_none,   col_nbr,    col_none },
-	[SchemeSel]             = { col_none,   col_none,   col_sbr,    col_sfl },
+	[SchemeSel]             = { col_none,   col_none,   col_sbr,    col_sfl  },
 	[SchemeTagsNorm]        = { col_tanfg,  col_tanbg,  col_tanbr,  col_none },
 	[SchemeTagsIncl]        = { col_taifg,  col_taibg,  col_taibr,  col_none },
 	[SchemeTagsSel]         = { col_tasfg,  col_tasbg,  col_tasbr,  col_none },
@@ -64,14 +64,6 @@ static const unsigned int ulinevoffset = 0; /* how far above the bottom of the b
 static const char ptagf[] = "[%s: %s]";     /* format of a tag label */
 static const char etagf[] = "[%s]";         /* format of an empty tag */
 
-static const Rule rules[] = { NULL
-	/* xprop(1):
-	 * WM_CLASS(STRING) = instance, class
-	 * WM_NAME(STRING) = title
-	 */
-	/* class            instance    title   tags mask   isfloating   monitor */
-};
-
 /* layout(s) */
 static int nmaster              = 1;    /* number of clients in master area */
 static int resizehints          = 0;    /* 1 means respect size hints in tiled resizals */
diff --git a/dwm.c b/dwm.c
@@ -135,15 +135,6 @@ struct Monitor {
 	Pertag *pertag;
 };
 
-typedef struct {
-	const char *class;
-	const char *instance;
-	const char *title;
-	unsigned int tags;
-	int isfloating;
-	int monitor;
-} Rule;
-
 /* Xresources preferences */
 enum resource_type {
 	STRING = 0,
@@ -164,7 +155,6 @@ typedef struct {
 } Command;
 
 /* function declarations */
-static void applyrules(Client *c);
 static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int interact);
 static void arrange(Monitor *m);
 static void arrangemon(Monitor *m);
@@ -322,45 +312,6 @@ struct Pertag {
 struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
 
 /* function implementations */
-void
-applyrules(Client *c)
-{
-	const char *class, *instance;
-	unsigned int i;
-	const Rule *r;
-	Monitor *m;
-	XClassHint ch = { NULL, NULL };
-
-	/* rule matching */
-	c->isfloating = 0;
-	c->tags = 0;
-	XGetClassHint(dpy, c->win, &ch);
-	class    = ch.res_class ? ch.res_class : broken;
-	instance = ch.res_name  ? ch.res_name  : broken;
-
-	for (i = 0; i < LENGTH(rules); i++) {
-		r = &rules[i];
-		if ((!r->title || strstr(c->name, r->title))
-		&& (!r->class || strstr(class, r->class))
-		&& (!r->instance || strstr(instance, r->instance)))
-		{
-			c->isfloating = r->isfloating;
-			c->tags |= r->tags;
-			for (m = mons; m && m->num != r->monitor; m = m->next);
-			if (m)
-				c->mon = m;
-		}
-	}
-	if (ch.res_class)
-		XFree(ch.res_class);
-	if (ch.res_name)
-		XFree(ch.res_name);
-	c->tags = c->tags & TAGMASK ? c->tags & TAGMASK
-		: c->mon->tagset[c->mon->seltags]
-		? c->mon->tagset[c->mon->seltags]
-		: 1;
-}
-
 int
 applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int interact)
 {
@@ -1337,7 +1288,11 @@ manage(Window w, XWindowAttributes *wa)
 		c->tags = t->tags;
 	} else {
 		c->mon = selmon;
-		applyrules(c);
+		c->isfloating = 0;
+		c->tags = c->tags & TAGMASK ? c->tags & TAGMASK
+			: c->mon->tagset[c->mon->seltags]
+			? c->mon->tagset[c->mon->seltags]
+			: 1;
 	}
 
 	if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)