mirror of
				https://github.com/tiyn/dwm.git
				synced 2025-11-04 13:11:15 +01:00 
			
		
		
		
	Merge remote-tracking branch 'origin/center'
This commit is contained in:
		@@ -27,9 +27,9 @@ static const Rule rules[] = {
 | 
				
			|||||||
	 *	WM_CLASS(STRING) = instance, class
 | 
						 *	WM_CLASS(STRING) = instance, class
 | 
				
			||||||
	 *	WM_NAME(STRING) = title
 | 
						 *	WM_NAME(STRING) = title
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	/* class      instance    title       tags mask     isfloating   monitor */
 | 
						/* class      instance    title       tags mask     iscentered     isfloating   monitor */
 | 
				
			||||||
	{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
 | 
						{ "Gimp",     NULL,       NULL,       0,            0,             1,           -1 },
 | 
				
			||||||
	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
 | 
						{ "Firefox",  NULL,       NULL,       1 << 8,       0,             0,           -1 },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* layout(s) */
 | 
					/* layout(s) */
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										58
									
								
								dwm-center-6.1.diff
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								dwm-center-6.1.diff
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					diff --git a/config.def.h b/config.def.h
 | 
				
			||||||
 | 
					index 7054c06..e0cdcf3 100644
 | 
				
			||||||
 | 
					--- a/config.def.h
 | 
				
			||||||
 | 
					+++ b/config.def.h
 | 
				
			||||||
 | 
					@@ -24,9 +24,9 @@ static const Rule rules[] = {
 | 
				
			||||||
 | 
					 	 *	WM_CLASS(STRING) = instance, class
 | 
				
			||||||
 | 
					 	 *	WM_NAME(STRING) = title
 | 
				
			||||||
 | 
					 	 */
 | 
				
			||||||
 | 
					-	/* class      instance    title       tags mask     isfloating   monitor */
 | 
				
			||||||
 | 
					-	{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
 | 
				
			||||||
 | 
					-	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
 | 
				
			||||||
 | 
					+	/* class      instance    title       tags mask     iscentered     isfloating   monitor */
 | 
				
			||||||
 | 
					+	{ "Gimp",     NULL,       NULL,       0,            0,             1,           -1 },
 | 
				
			||||||
 | 
					+	{ "Firefox",  NULL,       NULL,       1 << 8,       0,             0,           -1 },
 | 
				
			||||||
 | 
					 };
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 /* layout(s) */
 | 
				
			||||||
 | 
					diff --git a/dwm.c b/dwm.c
 | 
				
			||||||
 | 
					index 0362114..4aaaa60 100644
 | 
				
			||||||
 | 
					--- a/dwm.c
 | 
				
			||||||
 | 
					+++ b/dwm.c
 | 
				
			||||||
 | 
					@@ -92,7 +92,7 @@ struct Client {
 | 
				
			||||||
 | 
					 	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 | 
				
			||||||
 | 
					 	int bw, oldbw;
 | 
				
			||||||
 | 
					 	unsigned int tags;
 | 
				
			||||||
 | 
					-	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
 | 
				
			||||||
 | 
					+	int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
 | 
				
			||||||
 | 
					 	Client *next;
 | 
				
			||||||
 | 
					 	Client *snext;
 | 
				
			||||||
 | 
					 	Monitor *mon;
 | 
				
			||||||
 | 
					@@ -137,6 +137,7 @@ typedef struct {
 | 
				
			||||||
 | 
					 	const char *instance;
 | 
				
			||||||
 | 
					 	const char *title;
 | 
				
			||||||
 | 
					 	unsigned int tags;
 | 
				
			||||||
 | 
					+	int iscentered;
 | 
				
			||||||
 | 
					 	int isfloating;
 | 
				
			||||||
 | 
					 	int monitor;
 | 
				
			||||||
 | 
					 } Rule;
 | 
				
			||||||
 | 
					@@ -296,6 +297,7 @@ applyrules(Client *c)
 | 
				
			||||||
 | 
					 		&& (!r->class || strstr(class, r->class))
 | 
				
			||||||
 | 
					 		&& (!r->instance || strstr(instance, r->instance)))
 | 
				
			||||||
 | 
					 		{
 | 
				
			||||||
 | 
					+			c->iscentered = r->iscentered;
 | 
				
			||||||
 | 
					 			c->isfloating = r->isfloating;
 | 
				
			||||||
 | 
					 			c->tags |= r->tags;
 | 
				
			||||||
 | 
					 			for (m = mons; m && m->num != r->monitor; m = m->next);
 | 
				
			||||||
 | 
					@@ -1063,6 +1065,11 @@ manage(Window w, XWindowAttributes *wa)
 | 
				
			||||||
 | 
					 	           && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
 | 
				
			||||||
 | 
					 	c->bw = borderpx;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					+	if(c->iscentered) {
 | 
				
			||||||
 | 
					+		c->x = (c->mon->mw - WIDTH(c)) / 2;
 | 
				
			||||||
 | 
					+		c->y = (c->mon->mh - HEIGHT(c)) / 2;
 | 
				
			||||||
 | 
					+	}
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					 	wc.border_width = c->bw;
 | 
				
			||||||
 | 
					 	XConfigureWindow(dpy, w, CWBorderWidth, &wc);
 | 
				
			||||||
 | 
					 	XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->pix);
 | 
				
			||||||
							
								
								
									
										9
									
								
								dwm.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								dwm.c
									
									
									
									
									
								
							@@ -92,7 +92,7 @@ struct Client {
 | 
				
			|||||||
	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 | 
						int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 | 
				
			||||||
	int bw, oldbw;
 | 
						int bw, oldbw;
 | 
				
			||||||
	unsigned int tags;
 | 
						unsigned int tags;
 | 
				
			||||||
	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
 | 
						int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
 | 
				
			||||||
	Client *next;
 | 
						Client *next;
 | 
				
			||||||
	Client *snext;
 | 
						Client *snext;
 | 
				
			||||||
	Monitor *mon;
 | 
						Monitor *mon;
 | 
				
			||||||
@@ -137,6 +137,7 @@ typedef struct {
 | 
				
			|||||||
	const char *instance;
 | 
						const char *instance;
 | 
				
			||||||
	const char *title;
 | 
						const char *title;
 | 
				
			||||||
	unsigned int tags;
 | 
						unsigned int tags;
 | 
				
			||||||
 | 
						int iscentered;
 | 
				
			||||||
	int isfloating;
 | 
						int isfloating;
 | 
				
			||||||
	int monitor;
 | 
						int monitor;
 | 
				
			||||||
} Rule;
 | 
					} Rule;
 | 
				
			||||||
@@ -299,6 +300,7 @@ applyrules(Client *c)
 | 
				
			|||||||
		&& (!r->class || strstr(class, r->class))
 | 
							&& (!r->class || strstr(class, r->class))
 | 
				
			||||||
		&& (!r->instance || strstr(instance, r->instance)))
 | 
							&& (!r->instance || strstr(instance, r->instance)))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
								c->iscentered = r->iscentered;
 | 
				
			||||||
			c->isfloating = r->isfloating;
 | 
								c->isfloating = r->isfloating;
 | 
				
			||||||
			c->tags |= r->tags;
 | 
								c->tags |= r->tags;
 | 
				
			||||||
			for (m = mons; m && m->num != r->monitor; m = m->next);
 | 
								for (m = mons; m && m->num != r->monitor; m = m->next);
 | 
				
			||||||
@@ -1078,6 +1080,11 @@ manage(Window w, XWindowAttributes *wa)
 | 
				
			|||||||
		&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
 | 
							&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
 | 
				
			||||||
	c->bw = borderpx;
 | 
						c->bw = borderpx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(c->iscentered) {
 | 
				
			||||||
 | 
							c->x = (c->mon->mw - WIDTH(c)) / 2;
 | 
				
			||||||
 | 
							c->y = (c->mon->mh - HEIGHT(c)) / 2;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wc.border_width = c->bw;
 | 
						wc.border_width = c->bw;
 | 
				
			||||||
	XConfigureWindow(dpy, w, CWBorderWidth, &wc);
 | 
						XConfigureWindow(dpy, w, CWBorderWidth, &wc);
 | 
				
			||||||
	XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
 | 
						XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user