timplemented nmaster appearance in mode label (using %u) - dwm - [fork] customi… | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 1d4a24dae02cfb3a3241c3d293e96dba910317bd | |
parent a768ea93fdb3adfa33b3ea7ccc7abfe86a2bfb2a | |
Author: Anselm R. Garbe <[email protected]> | |
Date: Mon, 8 Jan 2007 17:33:24 +0100 | |
implemented nmaster appearance in mode label (using %u) | |
Diffstat: | |
M config.arg.h | 2 +- | |
M config.default.h | 2 +- | |
M config.mk | 2 +- | |
M draw.c | 2 +- | |
M dwm.h | 1 + | |
M main.c | 5 +++-- | |
M view.c | 12 ++++++++++-- | |
7 files changed, 18 insertions(+), 8 deletions(-) | |
--- | |
diff --git a/config.arg.h b/config.arg.h | |
t@@ -7,7 +7,7 @@ const char *tags[] = { "home", "net", "www", "mon", "fnord", N… | |
#define DEFMODE dotile /* dofloat */ | |
#define FLOATSYMBOL "><>" | |
-#define TILESYMBOL "[]=" | |
+#define TILESYMBOL "[%u]=" | |
#define FONT "-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*" | |
#define NORMBGCOLOR "#111111" | |
diff --git a/config.default.h b/config.default.h | |
t@@ -7,7 +7,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8",… | |
#define DEFMODE dotile /* dofloat */ | |
#define FLOATSYMBOL "><>" | |
-#define TILESYMBOL "[]=" | |
+#define TILESYMBOL "[%u]=" | |
#define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*… | |
#define NORMBGCOLOR "#333366" | |
diff --git a/config.mk b/config.mk | |
t@@ -1,5 +1,5 @@ | |
# dwm version | |
-VERSION = 2.9 | |
+VERSION = 3.0 | |
# Customize below to fit your system | |
diff --git a/draw.c b/draw.c | |
t@@ -120,7 +120,7 @@ drawstatus(void) { | |
dc.x += dc.w; | |
} | |
dc.w = bmw; | |
- drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, Fa… | |
+ drawtext(mtext, dc.status, False, False); | |
x = dc.x + dc.w; | |
dc.w = textw(stext); | |
dc.x = bw - dc.w; | |
diff --git a/dwm.h b/dwm.h | |
t@@ -93,6 +93,7 @@ struct Client { | |
extern const char *tags[]; /* all tags */ | |
extern char stext[1024]; /* status text */ | |
+extern char mtext[32]; /* mode text */ | |
extern int bx, by, bw, bh, bmw; /* bar geometry, bar mo… | |
extern int screen, sx, sy, sw, sh; /* screen geometry */ | |
extern int wax, way, wah, waw; /* windowarea geometry */ | |
diff --git a/main.c b/main.c | |
t@@ -17,7 +17,7 @@ | |
/* extern */ | |
-char stext[1024]; | |
+char stext[1024], mtext[32]; | |
Bool *seltag; | |
int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh, wax, way, waw, wah; | |
unsigned int master, nmaster, ntags, numlockmask; | |
t@@ -128,12 +128,13 @@ setup(void) { | |
dc.status[ColFG] = getcolor(STATUSFGCOLOR); | |
setfont(FONT); | |
/* geometry */ | |
- bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : te… | |
sx = sy = 0; | |
sw = DisplayWidth(dpy, screen); | |
sh = DisplayHeight(dpy, screen); | |
master = MASTER; | |
nmaster = NMASTER; | |
+ snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILES… | |
+ bmw = textw(mtext); | |
/* bar */ | |
bx = sx; | |
by = sy; | |
diff --git a/view.c b/view.c | |
t@@ -2,6 +2,7 @@ | |
* See LICENSE file for license details. | |
*/ | |
#include "dwm.h" | |
+#include <stdio.h> | |
/* static */ | |
t@@ -149,10 +150,15 @@ focusprev(Arg *arg) { | |
void | |
incnmaster(Arg *arg) { | |
- if((nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh)) | |
+ if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster +… | |
return; | |
nmaster += arg->i; | |
- arrange(); | |
+ snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILES… | |
+ bmw = textw(mtext); | |
+ if(sel) | |
+ arrange(); | |
+ else | |
+ drawstatus(); | |
} | |
Bool | |
t@@ -218,6 +224,8 @@ togglefloat(Arg *arg) { | |
void | |
togglemode(Arg *arg) { | |
arrange = (arrange == dofloat) ? dotile : dofloat; | |
+ snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILES… | |
+ bmw = textw(mtext); | |
if(sel) | |
arrange(); | |
else |