implemented dynamic layout symbol stuff
This commit is contained in:
		
							parent
							
								
									c3feffa1e2
								
							
						
					
					
						commit
						e7300e0f6f
					
				
							
								
								
									
										15
									
								
								dwm.1
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								dwm.1
									
									
									
									
									
								
							| @ -20,14 +20,13 @@ Windows are grouped by tags. Each window can be tagged with one or multiple | |||||||
| tags. Selecting certain tags displays all windows with these tags. | tags. Selecting certain tags displays all windows with these tags. | ||||||
| .P | .P | ||||||
| Each screen contains a small status bar which displays all available tags, the | Each screen contains a small status bar which displays all available tags, the | ||||||
| layout, the number of visible windows, the title of the focused window, and the | layout, the title of the focused window, and the text read from the root window | ||||||
| text read from the root window name property, if the screen is focused. A | name property, if the screen is focused. A floating window is indicated with an | ||||||
| floating window is indicated with an empty square and a maximised floating | empty square and a maximised floating window is indicated with a filled square | ||||||
| window is indicated with a filled square before the windows title.  The | before the windows title.  The selected tags are indicated with a different | ||||||
| selected tags are indicated with a different color. The tags of the focused | color. The tags of the focused window are indicated with a filled square in the | ||||||
| window are indicated with a filled square in the top left corner.  The tags | top left corner.  The tags which are applied to one or more windows are | ||||||
| which are applied to one or more windows are indicated with an empty square in | indicated with an empty square in the top left corner. | ||||||
| the top left corner. |  | ||||||
| .P | .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 | ||||||
|  | |||||||
							
								
								
									
										35
									
								
								dwm.c
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								dwm.c
									
									
									
									
									
								
							| @ -121,6 +121,7 @@ typedef struct { | |||||||
| } Layout; | } Layout; | ||||||
| 
 | 
 | ||||||
| struct Monitor { | struct Monitor { | ||||||
|  | 	const char *ltsymbol; | ||||||
| 	float mfact; | 	float mfact; | ||||||
| 	int num; | 	int num; | ||||||
| 	int by;               /* bar geometry */ | 	int by;               /* bar geometry */ | ||||||
| @ -238,7 +239,7 @@ static void zoom(const Arg *arg); | |||||||
| 
 | 
 | ||||||
| /* variables */ | /* variables */ | ||||||
| static const char broken[] = "broken"; | static const char broken[] = "broken"; | ||||||
| static char stext[256], ntext[8]; | static char stext[256]; | ||||||
| static int screen; | static int screen; | ||||||
| static int sw, sh;           /* X display screen geometry width, height */ | static int sw, sh;           /* X display screen geometry width, height */ | ||||||
| static int bh, blw = 0;      /* bar geometry */ | static int bh, blw = 0;      /* bar geometry */ | ||||||
| @ -384,6 +385,7 @@ arrange(void) { | |||||||
| 		showhide(m->stack); | 		showhide(m->stack); | ||||||
| 	focus(NULL); | 	focus(NULL); | ||||||
| 	for(m = mons; m; m = m->next) { | 	for(m = mons; m; m = m->next) { | ||||||
|  | 		m->ltsymbol = m->lt[m->sellt]->symbol; | ||||||
| 		if(m->lt[m->sellt]->arrange) | 		if(m->lt[m->sellt]->arrange) | ||||||
| 			m->lt[m->sellt]->arrange(m); | 			m->lt[m->sellt]->arrange(m); | ||||||
| 		restack(m); | 		restack(m); | ||||||
| @ -649,13 +651,11 @@ dirtomon(int dir) { | |||||||
| void | void | ||||||
| drawbar(Monitor *m) { | drawbar(Monitor *m) { | ||||||
| 	int x; | 	int x; | ||||||
| 	unsigned int i, n = 0, occ = 0, urg = 0; | 	unsigned int i, occ = 0, urg = 0; | ||||||
| 	unsigned long *col; | 	unsigned long *col; | ||||||
| 	Client *c; | 	Client *c; | ||||||
| 
 | 
 | ||||||
| 	for(c = m->clients; c; c = c->next) { | 	for(c = m->clients; c; c = c->next) { | ||||||
| 		if(ISVISIBLE(c)) |  | ||||||
| 			n++; |  | ||||||
| 		occ |= c->tags; | 		occ |= c->tags; | ||||||
| 		if(c->isurgent) | 		if(c->isurgent) | ||||||
| 			urg |= c->tags; | 			urg |= c->tags; | ||||||
| @ -669,15 +669,10 @@ drawbar(Monitor *m) { | |||||||
| 		           occ & 1 << i, urg & 1 << i, col); | 		           occ & 1 << i, urg & 1 << i, col); | ||||||
| 		dc.x += dc.w; | 		dc.x += dc.w; | ||||||
| 	} | 	} | ||||||
| 	if(blw > 0) { | 	dc.w = blw = TEXTW(m->ltsymbol); | ||||||
| 		dc.w = blw; | 	drawtext(m->ltsymbol, dc.norm, False); | ||||||
| 		drawtext(m->lt[m->sellt]->symbol, dc.norm, False); |  | ||||||
| 	dc.x += dc.w; | 	dc.x += dc.w; | ||||||
| 	} | 	x = dc.x; | ||||||
| 	snprintf(ntext, sizeof ntext, "%u", n); |  | ||||||
| 	dc.w = TEXTW(ntext); |  | ||||||
| 	drawtext(ntext, dc.norm, False); |  | ||||||
| 	x = (dc.x += dc.w); |  | ||||||
| 	if(m == selmon) { /* status is only drawn on selected monitor */ | 	if(m == selmon) { /* status is only drawn on selected monitor */ | ||||||
| 		dc.w = TEXTW(stext); | 		dc.w = TEXTW(stext); | ||||||
| 		dc.x = m->ww - dc.w; | 		dc.x = m->ww - dc.w; | ||||||
| @ -1137,8 +1132,17 @@ maprequest(XEvent *e) { | |||||||
| 
 | 
 | ||||||
| void | void | ||||||
| monocle(Monitor *m) { | monocle(Monitor *m) { | ||||||
|  | 	static char ntext[8]; | ||||||
|  | 	unsigned int n = 0; | ||||||
| 	Client *c; | 	Client *c; | ||||||
| 
 | 
 | ||||||
|  | 	for(c = m->clients; c; c = c->next) | ||||||
|  | 		if(ISVISIBLE(c)) | ||||||
|  | 			n++; | ||||||
|  | 	if(n > 0) { /* override layout symbol */ | ||||||
|  | 		snprintf(ntext, sizeof ntext, "[%d]", n); | ||||||
|  | 		m->ltsymbol = ntext; | ||||||
|  | 	} | ||||||
| 	for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) | 	for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) | ||||||
| 		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False); | 		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False); | ||||||
| } | } | ||||||
| @ -1431,8 +1435,6 @@ setmfact(const Arg *arg) { | |||||||
| 
 | 
 | ||||||
| void | void | ||||||
| setup(void) { | setup(void) { | ||||||
| 	unsigned int i; |  | ||||||
| 	int w; |  | ||||||
| 	XSetWindowAttributes wa; | 	XSetWindowAttributes wa; | ||||||
| 
 | 
 | ||||||
| 	/* clean up any zombies immediately */ | 	/* clean up any zombies immediately */ | ||||||
| @ -1469,10 +1471,6 @@ setup(void) { | |||||||
| 	if(!dc.font.set) | 	if(!dc.font.set) | ||||||
| 		XSetFont(dpy, dc.gc, dc.font.xfont->fid); | 		XSetFont(dpy, dc.gc, dc.font.xfont->fid); | ||||||
| 	/* init bars */ | 	/* init bars */ | ||||||
| 	for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) { |  | ||||||
| 		w = TEXTW(layouts[i].symbol); |  | ||||||
| 		blw = MAX(blw, w); |  | ||||||
| 	} |  | ||||||
| 	updatebars(); | 	updatebars(); | ||||||
| 	updatestatus(); | 	updatestatus(); | ||||||
| 	/* EWMH support per view */ | 	/* EWMH support per view */ | ||||||
| @ -1752,6 +1750,7 @@ updategeom(void) { | |||||||
| 		m->topbar = topbar; | 		m->topbar = topbar; | ||||||
| 		m->lt[0] = &layouts[0]; | 		m->lt[0] = &layouts[0]; | ||||||
| 		m->lt[1] = &layouts[1 % LENGTH(layouts)]; | 		m->lt[1] = &layouts[1 % LENGTH(layouts)]; | ||||||
|  | 		m->ltsymbol = layouts[0].symbol; | ||||||
| 		updatebarpos(m); | 		updatebarpos(m); | ||||||
| 	} | 	} | ||||||
| 	/* reassign left over clients of disappeared monitors */ | 	/* reassign left over clients of disappeared monitors */ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Anselm R Garbe
						Anselm R Garbe