aewl
changeset 674:5d79c351e30a
implemented nmaster appearance in mode label (using %u)
author | Anselm R. Garbe <arg@suckless.org> |
---|---|
date | Mon, 08 Jan 2007 17:33:24 +0100 |
parents | d47d6e28441b |
children | 1438e35b622e |
files | config.arg.h config.default.h config.mk draw.c dwm.h main.c view.c |
diffstat | 7 files changed, 18 insertions(+), 8 deletions(-) [+] |
line diff
1.1 --- a/config.arg.h Mon Jan 08 13:01:37 2007 +0100 1.2 +++ b/config.arg.h Mon Jan 08 17:33:24 2007 +0100 1.3 @@ -7,7 +7,7 @@ 1.4 1.5 #define DEFMODE dotile /* dofloat */ 1.6 #define FLOATSYMBOL "><>" 1.7 -#define TILESYMBOL "[]=" 1.8 +#define TILESYMBOL "[%u]=" 1.9 1.10 #define FONT "-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*" 1.11 #define NORMBGCOLOR "#111111"
2.1 --- a/config.default.h Mon Jan 08 13:01:37 2007 +0100 2.2 +++ b/config.default.h Mon Jan 08 17:33:24 2007 +0100 2.3 @@ -7,7 +7,7 @@ 2.4 2.5 #define DEFMODE dotile /* dofloat */ 2.6 #define FLOATSYMBOL "><>" 2.7 -#define TILESYMBOL "[]=" 2.8 +#define TILESYMBOL "[%u]=" 2.9 2.10 #define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*" 2.11 #define NORMBGCOLOR "#333366"
3.1 --- a/config.mk Mon Jan 08 13:01:37 2007 +0100 3.2 +++ b/config.mk Mon Jan 08 17:33:24 2007 +0100 3.3 @@ -1,5 +1,5 @@ 3.4 # dwm version 3.5 -VERSION = 2.9 3.6 +VERSION = 3.0 3.7 3.8 # Customize below to fit your system 3.9
4.1 --- a/draw.c Mon Jan 08 13:01:37 2007 +0100 4.2 +++ b/draw.c Mon Jan 08 17:33:24 2007 +0100 4.3 @@ -120,7 +120,7 @@ 4.4 dc.x += dc.w; 4.5 } 4.6 dc.w = bmw; 4.7 - drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False, False); 4.8 + drawtext(mtext, dc.status, False, False); 4.9 x = dc.x + dc.w; 4.10 dc.w = textw(stext); 4.11 dc.x = bw - dc.w;
5.1 --- a/dwm.h Mon Jan 08 13:01:37 2007 +0100 5.2 +++ b/dwm.h Mon Jan 08 17:33:24 2007 +0100 5.3 @@ -93,6 +93,7 @@ 5.4 5.5 extern const char *tags[]; /* all tags */ 5.6 extern char stext[1024]; /* status text */ 5.7 +extern char mtext[32]; /* mode text */ 5.8 extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */ 5.9 extern int screen, sx, sy, sw, sh; /* screen geometry */ 5.10 extern int wax, way, wah, waw; /* windowarea geometry */
6.1 --- a/main.c Mon Jan 08 13:01:37 2007 +0100 6.2 +++ b/main.c Mon Jan 08 17:33:24 2007 +0100 6.3 @@ -17,7 +17,7 @@ 6.4 6.5 /* extern */ 6.6 6.7 -char stext[1024]; 6.8 +char stext[1024], mtext[32]; 6.9 Bool *seltag; 6.10 int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh, wax, way, waw, wah; 6.11 unsigned int master, nmaster, ntags, numlockmask; 6.12 @@ -128,12 +128,13 @@ 6.13 dc.status[ColFG] = getcolor(STATUSFGCOLOR); 6.14 setfont(FONT); 6.15 /* geometry */ 6.16 - bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : textw(FLOATSYMBOL); 6.17 sx = sy = 0; 6.18 sw = DisplayWidth(dpy, screen); 6.19 sh = DisplayHeight(dpy, screen); 6.20 master = MASTER; 6.21 nmaster = NMASTER; 6.22 + snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster); 6.23 + bmw = textw(mtext); 6.24 /* bar */ 6.25 bx = sx; 6.26 by = sy;
7.1 --- a/view.c Mon Jan 08 13:01:37 2007 +0100 7.2 +++ b/view.c Mon Jan 08 17:33:24 2007 +0100 7.3 @@ -2,6 +2,7 @@ 7.4 * See LICENSE file for license details. 7.5 */ 7.6 #include "dwm.h" 7.7 +#include <stdio.h> 7.8 7.9 /* static */ 7.10 7.11 @@ -149,10 +150,15 @@ 7.12 7.13 void 7.14 incnmaster(Arg *arg) { 7.15 - if((nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh)) 7.16 + if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh)) 7.17 return; 7.18 nmaster += arg->i; 7.19 - arrange(); 7.20 + snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster); 7.21 + bmw = textw(mtext); 7.22 + if(sel) 7.23 + arrange(); 7.24 + else 7.25 + drawstatus(); 7.26 } 7.27 7.28 Bool 7.29 @@ -218,6 +224,8 @@ 7.30 void 7.31 togglemode(Arg *arg) { 7.32 arrange = (arrange == dofloat) ? dotile : dofloat; 7.33 + snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster); 7.34 + bmw = textw(mtext); 7.35 if(sel) 7.36 arrange(); 7.37 else