mirror of
				https://github.com/tiyn/dwm.git
				synced 2025-11-04 05:01:15 +01:00 
			
		
		
		
	Merge branch 'alttagsdecoration'
This commit is contained in:
		@@ -20,6 +20,7 @@ static const char *colors[][3]      = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* tagging */
 | 
					/* tagging */
 | 
				
			||||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
 | 
					static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
 | 
				
			||||||
 | 
					static const char *alttags[] = { "<01>", "<02>", "<03>", "<04>", "<05>" };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const Rule rules[] = {
 | 
					static const Rule rules[] = {
 | 
				
			||||||
	/* xprop(1):
 | 
						/* xprop(1):
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										67
									
								
								dwm-alttagsdecoration-2020010304-cb3f58a.diff
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								dwm-alttagsdecoration-2020010304-cb3f58a.diff
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
				
			|||||||
 | 
					diff --git a/config.def.h b/config.def.h
 | 
				
			||||||
 | 
					index 1c0b587..d4b11fc 100644
 | 
				
			||||||
 | 
					--- a/config.def.h
 | 
				
			||||||
 | 
					+++ b/config.def.h
 | 
				
			||||||
 | 
					@@ -20,6 +20,7 @@ static const char *colors[][3]      = {
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 /* tagging */
 | 
				
			||||||
 | 
					 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
 | 
				
			||||||
 | 
					+static const char *alttags[] = { "<01>", "<02>", "<03>", "<04>", "<05>" };
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 static const Rule rules[] = {
 | 
				
			||||||
 | 
					 	/* xprop(1):
 | 
				
			||||||
 | 
					diff --git a/dwm.c b/dwm.c
 | 
				
			||||||
 | 
					index 4465af1..a394159 100644
 | 
				
			||||||
 | 
					--- a/dwm.c
 | 
				
			||||||
 | 
					+++ b/dwm.c
 | 
				
			||||||
 | 
					@@ -416,7 +416,7 @@ attachstack(Client *c)
 | 
				
			||||||
 | 
					 void
 | 
				
			||||||
 | 
					 buttonpress(XEvent *e)
 | 
				
			||||||
 | 
					 {
 | 
				
			||||||
 | 
					-	unsigned int i, x, click;
 | 
				
			||||||
 | 
					+	unsigned int i, x, click, occ;
 | 
				
			||||||
 | 
					 	Arg arg = {0};
 | 
				
			||||||
 | 
					 	Client *c;
 | 
				
			||||||
 | 
					 	Monitor *m;
 | 
				
			||||||
 | 
					@@ -430,9 +430,13 @@ buttonpress(XEvent *e)
 | 
				
			||||||
 | 
					 		focus(NULL);
 | 
				
			||||||
 | 
					 	}
 | 
				
			||||||
 | 
					 	if (ev->window == selmon->barwin) {
 | 
				
			||||||
 | 
					-		i = x = 0;
 | 
				
			||||||
 | 
					+		i = x = occ = 0;
 | 
				
			||||||
 | 
					+		/* Bitmask of occupied tags */
 | 
				
			||||||
 | 
					+		for (c = m->clients; c; c = c->next)
 | 
				
			||||||
 | 
					+			occ |= c->tags;
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					 		do
 | 
				
			||||||
 | 
					-			x += TEXTW(tags[i]);
 | 
				
			||||||
 | 
					+			x += TEXTW(occ & 1 << i ? alttags[i] : tags[i]);
 | 
				
			||||||
 | 
					 		while (ev->x >= x && ++i < LENGTH(tags));
 | 
				
			||||||
 | 
					 		if (i < LENGTH(tags)) {
 | 
				
			||||||
 | 
					 			click = ClkTagBar;
 | 
				
			||||||
 | 
					@@ -699,6 +703,7 @@ drawbar(Monitor *m)
 | 
				
			||||||
 | 
					 	int boxs = drw->fonts->h / 9;
 | 
				
			||||||
 | 
					 	int boxw = drw->fonts->h / 6 + 2;
 | 
				
			||||||
 | 
					 	unsigned int i, occ = 0, urg = 0;
 | 
				
			||||||
 | 
					+	const char *tagtext;
 | 
				
			||||||
 | 
					 	Client *c;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 	/* draw status first so it can be overdrawn by tags later */
 | 
				
			||||||
 | 
					@@ -715,13 +720,10 @@ drawbar(Monitor *m)
 | 
				
			||||||
 | 
					 	}
 | 
				
			||||||
 | 
					 	x = 0;
 | 
				
			||||||
 | 
					 	for (i = 0; i < LENGTH(tags); i++) {
 | 
				
			||||||
 | 
					-		w = TEXTW(tags[i]);
 | 
				
			||||||
 | 
					-		drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
 | 
				
			||||||
 | 
					-		drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
 | 
				
			||||||
 | 
					-		if (occ & 1 << i)
 | 
				
			||||||
 | 
					-			drw_rect(drw, x + boxs, boxs, boxw, boxw,
 | 
				
			||||||
 | 
					-				m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
 | 
				
			||||||
 | 
					-				urg & 1 << i);
 | 
				
			||||||
 | 
					+		tagtext = occ & 1 << i ? alttags[i] : tags[i];
 | 
				
			||||||
 | 
					+		w = TEXTW(tagtext);
 | 
				
			||||||
 | 
					+ 		drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
 | 
				
			||||||
 | 
					+		drw_text(drw, x, 0, w, bh, lrpad / 2, tagtext, urg & 1 << i);
 | 
				
			||||||
 | 
					 		x += w;
 | 
				
			||||||
 | 
					 	}
 | 
				
			||||||
 | 
					 	w = blw = TEXTW(m->ltsymbol);
 | 
				
			||||||
							
								
								
									
										22
									
								
								dwm.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								dwm.c
									
									
									
									
									
								
							@@ -417,7 +417,7 @@ attachstack(Client *c)
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
buttonpress(XEvent *e)
 | 
					buttonpress(XEvent *e)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	unsigned int i, x, click;
 | 
						unsigned int i, x, click, occ;
 | 
				
			||||||
	Arg arg = {0};
 | 
						Arg arg = {0};
 | 
				
			||||||
	Client *c;
 | 
						Client *c;
 | 
				
			||||||
	Monitor *m;
 | 
						Monitor *m;
 | 
				
			||||||
@@ -431,9 +431,13 @@ buttonpress(XEvent *e)
 | 
				
			|||||||
		focus(NULL);
 | 
							focus(NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (ev->window == selmon->barwin) {
 | 
						if (ev->window == selmon->barwin) {
 | 
				
			||||||
		i = x = 0;
 | 
							i = x = occ = 0;
 | 
				
			||||||
 | 
							/* Bitmask of occupied tags */
 | 
				
			||||||
 | 
							for (c = m->clients; c; c = c->next)
 | 
				
			||||||
 | 
								occ |= c->tags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		do
 | 
							do
 | 
				
			||||||
			x += TEXTW(tags[i]);
 | 
								x += TEXTW(occ & 1 << i ? alttags[i] : tags[i]);
 | 
				
			||||||
		while (ev->x >= x && ++i < LENGTH(tags));
 | 
							while (ev->x >= x && ++i < LENGTH(tags));
 | 
				
			||||||
		if (i < LENGTH(tags)) {
 | 
							if (i < LENGTH(tags)) {
 | 
				
			||||||
			click = ClkTagBar;
 | 
								click = ClkTagBar;
 | 
				
			||||||
@@ -700,6 +704,7 @@ drawbar(Monitor *m)
 | 
				
			|||||||
	int boxs = drw->fonts->h / 9;
 | 
						int boxs = drw->fonts->h / 9;
 | 
				
			||||||
	int boxw = drw->fonts->h / 6 + 2;
 | 
						int boxw = drw->fonts->h / 6 + 2;
 | 
				
			||||||
	unsigned int i, occ = 0, urg = 0;
 | 
						unsigned int i, occ = 0, urg = 0;
 | 
				
			||||||
 | 
						const char *tagtext;
 | 
				
			||||||
	Client *c;
 | 
						Client *c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* draw status first so it can be overdrawn by tags later */
 | 
						/* draw status first so it can be overdrawn by tags later */
 | 
				
			||||||
@@ -716,13 +721,10 @@ drawbar(Monitor *m)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	x = 0;
 | 
						x = 0;
 | 
				
			||||||
	for (i = 0; i < LENGTH(tags); i++) {
 | 
						for (i = 0; i < LENGTH(tags); i++) {
 | 
				
			||||||
		w = TEXTW(tags[i]);
 | 
							tagtext = occ & 1 << i ? alttags[i] : tags[i];
 | 
				
			||||||
		drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
 | 
							w = TEXTW(tagtext);
 | 
				
			||||||
		drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
 | 
					 		drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
 | 
				
			||||||
		if (occ & 1 << i)
 | 
							drw_text(drw, x, 0, w, bh, lrpad / 2, tagtext, urg & 1 << i);
 | 
				
			||||||
			drw_rect(drw, x + boxs, boxs, boxw, boxw,
 | 
					 | 
				
			||||||
				m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
 | 
					 | 
				
			||||||
				urg & 1 << i);
 | 
					 | 
				
			||||||
		x += w;
 | 
							x += w;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	w = blw = TEXTW(m->ltsymbol);
 | 
						w = blw = TEXTW(m->ltsymbol);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user