commit d44f00541bd3ff5f5bd63bf2ef174c82c87f1c98
parent deebf2af3f1058a12b9a8446a3c4810a3d48ae98
Author: Quentin Rameau <quinq@fifth.space>
Date: Sun, 3 Jan 2016 18:33:17 +0100
tabbed: update client number patch
Diffstat:
3 files changed, 27 insertions(+), 39 deletions(-)
diff --git a/tools.suckless.org/tabbed/patches/clientnumber.md b/tools.suckless.org/tabbed/patches/clientnumber.md
@@ -1,12 +1,13 @@
Client number
-========
+=============
With this patch, tabbed prints the position number of the client before the
window title.
Download
--------
-* [tabbed-0.6-clientnumber.diff](tabbed-0.6-clientnumber.diff)
+* [tabbed-clientnumber-20160103-eb0ff62.patch](tabbed-clientnumber-20160103-eb0ff62.patch)
+ (works with 0.6).
Author
------
-* Quentin Rameau <quinq@quinq.eu.org>
+* Quentin Rameau <quinq@fifth.space>
diff --git a/tools.suckless.org/tabbed/patches/tabbed-0.6-clientnumber.diff b/tools.suckless.org/tabbed/patches/tabbed-0.6-clientnumber.diff
@@ -1,36 +0,0 @@
-diff --git a/config.mk b/config.mk
-index 5279711..b0c212c 100644
---- a/config.mk
-+++ b/config.mk
-@@ -12,7 +12,7 @@ INCS = -I. -I/usr/include
- LIBS = -L/usr/lib -lc -lX11
-
- # flags
--CPPFLAGS = -DVERSION=\"${VERSION}\" -D_BSD_SOURCE
-+CPPFLAGS = -DVERSION=\"${VERSION}\" -D_BSD_SOURCE -D_GNU_SOURCE
- CFLAGS = -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
- LDFLAGS = -s ${LIBS}
-
-diff --git a/tabbed.c b/tabbed.c
-index b2adf29..19b5bbb 100644
---- a/tabbed.c
-+++ b/tabbed.c
-@@ -308,6 +308,7 @@ drawbar(void) {
- unsigned long *col;
- int c, fc, width, n = 0;
- char *name = NULL;
-+ char *tabtitle = NULL;
-
- if(nclients == 0) {
- dc.x = 0;
-@@ -353,7 +354,9 @@ drawbar(void) {
- } else {
- col = dc.norm;
- }
-- drawtext(clients[c]->name, col);
-+ asprintf(&tabtitle, "%d: %s", c + 1, clients[c]->name);
-+ drawtext(tabtitle, col);
-+ free(tabtitle);
- dc.x += dc.w;
- clients[c]->tabx = dc.x;
- }
diff --git a/tools.suckless.org/tabbed/patches/tabbed-clientnumber-20160103-eb0ff62.patch b/tools.suckless.org/tabbed/patches/tabbed-clientnumber-20160103-eb0ff62.patch
@@ -0,0 +1,23 @@
+diff --git a/tabbed.c b/tabbed.c
+index 5f035c0..b118050 100644
+--- a/tabbed.c
++++ b/tabbed.c
+@@ -317,6 +317,7 @@ drawbar(void)
+ unsigned long *col;
+ int c, cc, fc, width;
+ char *name = NULL;
++ char tabtitle[258]; /* drawtext buffer + one char + '\0' */
+
+ if (nclients == 0) {
+ dc.x = 0;
+@@ -358,7 +359,9 @@ drawbar(void)
+ } else {
+ col = clients[c]->urgent ? dc.urg : dc.norm;
+ }
+- drawtext(clients[c]->name, col);
++ snprintf(tabtitle, sizeof(tabtitle), "%d: %s",
++ c + 1, clients[c]->name);
++ drawtext(tabtitle, col);
+ dc.x += dc.w;
+ clients[c]->tabx = dc.x;
+ }