Hi Eric

On Mon, Apr 02, 2018 at 08:59:57PM -0700, Eric Pruitt wrote:
> On Mon, Apr 02, 2018 at 11:10:42AM +0200, Silvan Jegen wrote:
> > error: git diff header lacks filename information when removing 1
> > leading pathname component (line 5)
> 
> Please try the attached patch.

I tried the attached patch and it didn't work either. After creating
a patch in this repo myself (and googling the error) I realized that
your patch didn't have the "a/", resp. "b/" string prefix in the diff
filenames. After adding these prefixes by hand (attached), the patch
applied for me.

How did you generate these patches? It's the first time I had this issue.

Anyways, I compiled the code and the code looks correct to me. I never
encountered this issue myself so I am not sure if this patch is really
needed or not. If it solves a real issue people are having, applying it
makes sense.


Cheers,

Silvan
>From 0b5c617c56f1c6a01034ae2dc5fc0cc114d590cd Mon Sep 17 00:00:00 2001
From: Eric Pruitt <eric.pru...@gmail.com>
Date: Sun, 1 Apr 2018 14:35:01 -0700
Subject: [PATCH] Make unset property fallback strings configurable

Since the default rule matching does substring comparisons, using the
fixed string "broken" as a fallback value can complicate or make
unambiguous matching impossible, so this change makes various fallback
strings for unset properties configurable via config.h.
---
 config.def.h | 5 +++++
 dwm.c        | 7 +++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/config.def.h b/config.def.h
index a9ac303..8dfc8b1 100644
--- config.def.h
+++ config.def.h
@@ -43,6 +43,11 @@ static const Layout layouts[] = {
        { "[M]",      monocle },
 };
 
+/* Fallback strings for unset window properties. */
+static const char unset_instance_fallback[] = "broken";
+static const char unset_class_fallback[] = "broken";
+static const char unset_name_fallback[] = "broken";
+
 /* key definitions */
 #define MODKEY Mod1Mask
 #define TAGKEYS(KEY,TAG) \
diff --git a/dwm.c b/dwm.c
index c98678d..9735e32 100644
--- dwm.c
+++ dwm.c
@@ -235,7 +235,6 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee);
 static void zoom(const Arg *arg);
 
 /* variables */
-static const char broken[] = "broken";
 static char stext[256];
 static int screen;
 static int sw, sh;           /* X display screen geometry width, height */
@@ -288,8 +287,8 @@ applyrules(Client *c)
        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;
+       class    = ch.res_class ? ch.res_class : unset_class_fallback;
+       instance = ch.res_name  ? ch.res_name  : unset_instance_fallback;
 
        for (i = 0; i < LENGTH(rules); i++) {
                r = &rules[i];
@@ -1998,7 +1997,7 @@ updatetitle(Client *c)
        if (!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name))
                gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
        if (c->name[0] == '\0') /* hack to mark broken clients */
-               strcpy(c->name, broken);
+               strcpy(c->name, unset_name_fallback);
 }
 
 void
-- 
2.11.0

Reply via email to