summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dwm.h1
-rw-r--r--main.c3
-rw-r--r--view.c12
3 files changed, 10 insertions, 6 deletions
diff --git a/dwm.h b/dwm.h
index 68b3e36..6a26e07 100644
--- a/dwm.h
+++ b/dwm.h
@@ -168,5 +168,6 @@ extern void restack(void); /* restores z layers of all clients */
168extern void togglefloat(Arg *arg); /* toggles focusesd client between floating/non-floating state */ 168extern void togglefloat(Arg *arg); /* toggles focusesd client between floating/non-floating state */
169extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */ 169extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */
170extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */ 170extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */
171extern void updatemodetext(void); /* updates mtext */
171extern void view(Arg *arg); /* views the tag with arg's index */ 172extern void view(Arg *arg); /* views the tag with arg's index */
172extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */ 173extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */
diff --git a/main.c b/main.c
index c080ada..ba5e2e0 100644
--- a/main.c
+++ b/main.c
@@ -133,8 +133,7 @@ setup(void) {
133 sh = DisplayHeight(dpy, screen); 133 sh = DisplayHeight(dpy, screen);
134 master = MASTER; 134 master = MASTER;
135 nmaster = NMASTER; 135 nmaster = NMASTER;
136 snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster); 136 updatemodetext();
137 bmw = textw(mtext);
138 /* bar */ 137 /* bar */
139 bx = sx; 138 bx = sx;
140 by = sy; 139 by = sy;
diff --git a/view.c b/view.c
index 2f2d42a..06aed3e 100644
--- a/view.c
+++ b/view.c
@@ -153,8 +153,7 @@ incnmaster(Arg *arg) {
153 if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh)) 153 if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh))
154 return; 154 return;
155 nmaster += arg->i; 155 nmaster += arg->i;
156 snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster); 156 updatemodetext();
157 bmw = textw(mtext);
158 if(sel) 157 if(sel)
159 arrange(); 158 arrange();
160 else 159 else
@@ -224,8 +223,7 @@ togglefloat(Arg *arg) {
224void 223void
225togglemode(Arg *arg) { 224togglemode(Arg *arg) {
226 arrange = (arrange == dofloat) ? dotile : dofloat; 225 arrange = (arrange == dofloat) ? dotile : dofloat;
227 snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster); 226 updatemodetext();
228 bmw = textw(mtext);
229 if(sel) 227 if(sel)
230 arrange(); 228 arrange();
231 else 229 else
@@ -244,6 +242,12 @@ toggleview(Arg *arg) {
244} 242}
245 243
246void 244void
245updatemodetext() {
246 snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster);
247 bmw = textw(mtext);
248}
249
250void
247view(Arg *arg) { 251view(Arg *arg) {
248 unsigned int i; 252 unsigned int i;
249 253