Apply nametag patch (dwm-nametag-prepend-6.2.diff) with prepend feature
This commit is contained in:
parent
72c2354871
commit
ff87856a4e
|
@ -6,6 +6,7 @@ Applied patches
|
|||
* focusonclick
|
||||
* hide_vacant_tags
|
||||
* movestack
|
||||
* nametag
|
||||
* nmaxmaster
|
||||
* pertag
|
||||
* resetnmaster
|
||||
|
|
|
@ -24,7 +24,10 @@ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display
|
|||
static const int showsystray = 1; /* 0 means no systray */
|
||||
|
||||
/* 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):
|
||||
|
@ -65,6 +68,7 @@ static const char *firefoxcmd[] = { "firefox", NULL };
|
|||
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_n, nametag, {0} },
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY|ShiftMask, XK_f, spawn, {.v = firefoxcmd } },
|
||||
|
|
29
dwm.c
29
dwm.c
|
@ -209,6 +209,7 @@ static void maprequest(XEvent *e);
|
|||
static void monocle(Monitor *m);
|
||||
static void movemouse(const Arg *arg);
|
||||
static void movestack(const Arg *arg);
|
||||
static void nametag(const Arg *arg);
|
||||
static Client *nexttiled(Client *c);
|
||||
static void pop(Client *);
|
||||
static void propertynotify(XEvent *e);
|
||||
|
@ -1481,6 +1482,34 @@ movemouse(const Arg *arg)
|
|||
}
|
||||
}
|
||||
|
||||
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\n", errno ? ": " : "", errno ? strerror(errno) : "");
|
||||
return;
|
||||
}
|
||||
if (!(p = fgets(name, MAX_TAGNAME_LEN, f)) && (i = errno) && ferror(f))
|
||||
fprintf(stderr, "dwm: fgets failed: %s\n", strerror(i));
|
||||
if (pclose(f) < 0)
|
||||
fprintf(stderr, "dwm: pclose failed: %s\n", strerror(errno));
|
||||
if(!p)
|
||||
return;
|
||||
if((p = strchr(name, '\n')))
|
||||
*p = '\0';
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
void
|
||||
movestack(const Arg *arg) {
|
||||
Client *c = NULL, *p = NULL, *pc = NULL, *i;
|
||||
|
|
Loading…
Reference in New Issue