applied attachbelow patch
This commit is contained in:
		
							parent
							
								
									f04cac6d6e
								
							
						
					
					
						commit
						efb0765d16
					
				| @ -35,6 +35,7 @@ static const Rule rules[] = { | |||||||
| static const float mfact     = 0.55; /* factor of master area size [0.05..0.95] */ | static const float mfact     = 0.55; /* factor of master area size [0.05..0.95] */ | ||||||
| static const int nmaster     = 1;    /* number of clients in master area */ | static const int nmaster     = 1;    /* number of clients in master area */ | ||||||
| static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */ | static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */ | ||||||
|  | static const int attachbelow = 1;    /* 1 means attach after the currently active window */ | ||||||
| 
 | 
 | ||||||
| static const Layout layouts[] = { | static const Layout layouts[] = { | ||||||
| 	/* symbol     arrange function */ | 	/* symbol     arrange function */ | ||||||
|  | |||||||
							
								
								
									
										3
									
								
								dwm.1
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								dwm.1
									
									
									
									
									
								
							| @ -29,6 +29,9 @@ color. The tags of the focused window are indicated with a filled square in the | |||||||
| top left corner.  The tags which are applied to one or more windows are | top left corner.  The tags which are applied to one or more windows are | ||||||
| indicated with an empty square in the top left corner. | indicated with an empty square in the top left corner. | ||||||
| .P | .P | ||||||
|  | The attach below patch makes newly spawned windows attach after the currently | ||||||
|  | selected window | ||||||
|  | .P | ||||||
| dwm draws a small border around windows to indicate the focus state. | dwm draws a small border around windows to indicate the focus state. | ||||||
| .SH OPTIONS | .SH OPTIONS | ||||||
| .TP | .TP | ||||||
|  | |||||||
							
								
								
									
										25
									
								
								dwm.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								dwm.c
									
									
									
									
									
								
							| @ -147,6 +147,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac | |||||||
| static void arrange(Monitor *m); | static void arrange(Monitor *m); | ||||||
| static void arrangemon(Monitor *m); | static void arrangemon(Monitor *m); | ||||||
| static void attach(Client *c); | static void attach(Client *c); | ||||||
|  | static void attachBelow(Client *c); | ||||||
| static void attachstack(Client *c); | static void attachstack(Client *c); | ||||||
| static void buttonpress(XEvent *e); | static void buttonpress(XEvent *e); | ||||||
| static void checkotherwm(void); | static void checkotherwm(void); | ||||||
| @ -406,6 +407,21 @@ attach(Client *c) | |||||||
| 	c->next = c->mon->clients; | 	c->next = c->mon->clients; | ||||||
| 	c->mon->clients = c; | 	c->mon->clients = c; | ||||||
| } | } | ||||||
|  | void | ||||||
|  | attachBelow(Client *c) | ||||||
|  | { | ||||||
|  | 	//If there is nothing on the monitor or the selected client is floating, attach as normal
 | ||||||
|  | 	if(c->mon->sel == NULL || c->mon->sel == c || c->mon->sel->isfloating) { | ||||||
|  | 		attach(c); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	//Set the new client's next property to the same as the currently selected clients next
 | ||||||
|  | 	c->next = c->mon->sel->next; | ||||||
|  | 	//Set the currently selected clients next property to the new client
 | ||||||
|  | 	c->mon->sel->next = c; | ||||||
|  | 
 | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| attachstack(Client *c) | attachstack(Client *c) | ||||||
| @ -1063,6 +1079,9 @@ manage(Window w, XWindowAttributes *wa) | |||||||
| 		c->isfloating = c->oldstate = trans != None || c->isfixed; | 		c->isfloating = c->oldstate = trans != None || c->isfixed; | ||||||
| 	if (c->isfloating) | 	if (c->isfloating) | ||||||
| 		XRaiseWindow(dpy, c->win); | 		XRaiseWindow(dpy, c->win); | ||||||
|  | 	if( attachbelow ) | ||||||
|  | 		attachBelow(c); | ||||||
|  | 	else | ||||||
| 		attach(c); | 		attach(c); | ||||||
| 	attachstack(c); | 	attachstack(c); | ||||||
| 	XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, | 	XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, | ||||||
| @ -1418,6 +1437,9 @@ sendmon(Client *c, Monitor *m) | |||||||
| 	detachstack(c); | 	detachstack(c); | ||||||
| 	c->mon = m; | 	c->mon = m; | ||||||
| 	c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ | 	c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ | ||||||
|  | 	if( attachbelow ) | ||||||
|  | 		attachBelow(c); | ||||||
|  | 	else | ||||||
| 		attach(c); | 		attach(c); | ||||||
| 	attachstack(c); | 	attachstack(c); | ||||||
| 	focus(NULL); | 	focus(NULL); | ||||||
| @ -1900,6 +1922,9 @@ updategeom(void) | |||||||
| 					m->clients = c->next; | 					m->clients = c->next; | ||||||
| 					detachstack(c); | 					detachstack(c); | ||||||
| 					c->mon = mons; | 					c->mon = mons; | ||||||
|  | 					if( attachbelow ) | ||||||
|  | 						attachBelow(c); | ||||||
|  | 					else | ||||||
| 						attach(c); | 						attach(c); | ||||||
| 					attachstack(c); | 					attachstack(c); | ||||||
| 				} | 				} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user