commit 6995eee0c8601cf81d64ee5d783eacdaa1319ba9
Author: Cédric <[email protected]>
Date:   Sun May 16 06:37:39 2021 +0000

    dwm-nametage-prepend patch update to dwm 6.2

diff --git a/dwm.suckless.org/patches/nametag/dwm-nametag-prepend-6.2.diff 
b/dwm.suckless.org/patches/nametag/dwm-nametag-prepend-6.2.diff
new file mode 100644
index 00000000..1e7c32e1
--- /dev/null
+++ b/dwm.suckless.org/patches/nametag/dwm-nametag-prepend-6.2.diff
@@ -0,0 +1,59 @@
+--- a/config.def.h
++++ b/config.def.h
+@@ -19,7 +19,10 @@
+ };
+ 
+ /* tagging */
+-static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
++#define MAX_TAGNAME_LEN 14            /* excludes TAG_PREPEND */
++#define TAG_PREPEND "%1i:"            /* formatted as 2 chars */
++#define MAX_TAGLEN 16                 /* altogether */
++static char tags[][MAX_TAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", 
"9" };
+ 
+ static const Rule rules[] = {
+       /* xprop(1):
+--- a/dwm.c
++++ b/dwm.c
+@@ -183,6 +183,7 @@
+ static void monocle(Monitor *m);
+ static void motionnotify(XEvent *e);
+ static void movemouse(const Arg *arg);
++static void nametag(const Arg *arg);
+ static Client *nexttiled(Client *c);
+ static void pop(Client *);
+ static void propertynotify(XEvent *e);
+@@ -1190,6 +1191,34 @@
+               selmon = m;
+               focus(NULL);
+       }
++}
++
++void
++nametag(const Arg *arg) {
++      char *p, name[MAX_TAGNAME_LEN];
++      FILE *f;
++      int i;
++
++      errno = 0; // popen(3p) says on failure it "may" set errno
++      if(!(f = popen("dmenu < /dev/null", "r"))) {
++              fprintf(stderr, "dwm: popen 'dmenu < /dev/null' failed%s%s
", errno ? ": " : "", errno ? strerror(errno) : "");
++              return;
++      }
++      if (!(p = fgets(name, MAX_TAGNAME_LEN, f)) && (i = errno) && ferror(f))
++              fprintf(stderr, "dwm: fgets failed: %s
", strerror(i));
++      if (pclose(f) < 0)
++              fprintf(stderr, "dwm: pclose failed: %s
", strerror(errno));
++      if(!p)
++              return;
++      if((p = strchr(name, '
')))
++              *p = '++
++      for(i = 0; i < LENGTH(tags); i++)
++              if(selmon->tagset[selmon->seltags] & (1 << i)) {
++                      sprintf(tags[i], TAG_PREPEND, i+1);
++                      strcat(tags[i], name);
++              }
++      drawbars();
+ }
+ 
+ Client *
diff --git a/dwm.suckless.org/patches/nametag/index.md 
b/dwm.suckless.org/patches/nametag/index.md
index 28fd124b..403ec2a6 100644
--- a/dwm.suckless.org/patches/nametag/index.md
+++ b/dwm.suckless.org/patches/nametag/index.md
@@ -16,6 +16,7 @@ default a tag name "foo" given to tag 5 will become tag 
"5:foo".
 
 Download
 --------
+* [dwm-nametag-prepend-6.2.diff](dwm-nametag-prepend-6.2.diff)
 * [dwm-nametag-6.1.diff](dwm-nametag-6.1.diff)
 * [dwm-nametag-prepend-6.1.diff](dwm-nametag-prepend-6.1.diff)
 * [dwm-nametag-5.7.2.diff](dwm-nametag-5.7.2.diff)
@@ -24,3 +25,4 @@ Author
 ------
 * Evan Gates (emg) <[email protected]>
 * prepend version by [Ondřej Grover](mailto:[email protected])
+* Cédric Macquat <[email protected]> (nametag-prepend 6.2 port)


Reply via email to