sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-nametag-5.7.2.diff (2475B)


      1 diff -r 2bcd25cce4ab config.def.h
      2 --- a/config.def.h	Sun Sep 27 20:20:14 2009 +0100
      3 +++ b/config.def.h	Thu Oct 29 12:27:26 2009 -0700
      4 @@ -14,7 +14,8 @@
      5  static const Bool topbar            = True;     /* False means bottom bar */
      6  
      7  /* tagging */
      8 -static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
      9 +#define MAX_TAGLEN 16
     10 +static char tags[][MAX_TAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     11  
     12  static const Rule rules[] = {
     13  	/* class      instance    title       tags mask     isfloating   monitor */
     14 @@ -71,6 +72,7 @@
     15  	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
     16  	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
     17  	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
     18 +	{ MODKEY,                       XK_n,      nametag,        {0} },
     19  	TAGKEYS(                        XK_1,                      0)
     20  	TAGKEYS(                        XK_2,                      1)
     21  	TAGKEYS(                        XK_3,                      2)
     22 diff -r 2bcd25cce4ab config.mk
     23 --- a/config.mk	Sun Sep 27 20:20:14 2009 +0100
     24 +++ b/config.mk	Thu Oct 29 12:27:26 2009 -0700
     25 @@ -19,7 +19,7 @@
     26  LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${XINERAMALIBS}
     27  
     28  # flags
     29 -CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
     30 +CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
     31  #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
     32  CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
     33  #LDFLAGS = -g ${LIBS}
     34 diff -r 2bcd25cce4ab dwm.c
     35 --- a/dwm.c	Sun Sep 27 20:20:14 2009 +0100
     36 +++ b/dwm.c	Thu Oct 29 12:27:26 2009 -0700
     37 @@ -195,6 +195,7 @@
     38  static void maprequest(XEvent *e);
     39  static void monocle(Monitor *m);
     40  static void movemouse(const Arg *arg);
     41 +static void nametag(const Arg *arg);
     42  static Client *nexttiled(Client *c);
     43  static Monitor *ptrtomon(int x, int y);
     44  static void propertynotify(XEvent *e);
     45 @@ -1240,6 +1241,25 @@
     46  	}
     47  }
     48  
     49 +void
     50 +nametag(const Arg *arg) {
     51 +	char *cp, name[MAX_TAGLEN];
     52 +	FILE *fp;
     53 +	int i;
     54 +
     55 +	if(!(fp = (FILE*)popen("echo -n | dmenu", "r")))
     56 +		fprintf(stderr, "dwm: Could not popen 'echo -n | dmenu'\n");
     57 +	cp = fgets(name, MAX_TAGLEN, fp);
     58 +	pclose(fp);
     59 +	if(cp == NULL)
     60 +		return;
     61 +
     62 +	for(i = 0; i < LENGTH(tags); i++)
     63 +		if(selmon->tagset[selmon->seltags] & (1 << i))
     64 +			memcpy(tags[i], name, MAX_TAGLEN);
     65 +	drawbars();
     66 +}
     67 +
     68  Client *
     69  nexttiled(Client *c) {
     70  	for(; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);