dwm

my fork of dwm
Index Commits Files Refs README LICENSE
commit 96ee9d888cc3cf90da3b6a6852d605255d25d020
parent a82cba275981ecd85e68cc68b169c89f79fa60db
Author: Anselm R Garbe <garbeam@gmail.com>
Date:   Tue,  4 Mar 2008 18:58:23 +0000

monocle goes mainstream
Diffstat:
Mconfig.def.h | 4+++-
Mdwm.c | 13++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -12,7 +12,7 @@
 #define SELFGCOLOR        "#ffffff"
 
 /* old */
-const char tags[][MAXTAGLEN]     = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
 
 Rule rules[] = {
     /* class:instance:title substr    tags ref    isfloating */
@@ -30,6 +30,7 @@ Layout layouts[] = {
     /* symbol        function */
     { "[]=",        tile }, /* first entry is default */
     { "><>",        floating },
+    { "[M]",        monocle },
 };
 
 /* key definitions */
@@ -46,6 +47,7 @@ Key keys[] = {
     { MODKEY,            XK_h,        setmwfact,    "-0.05" },
     { MODKEY,            XK_l,        setmwfact,    "+0.05" },
     { MODKEY,            XK_r,        reapply,    NULL },
+    { MODKEY,            XK_m,        setlayout,    "[M]" },
     { MODKEY,            XK_Return,    zoom,        NULL },
     { MODKEY,            XK_Tab,        viewprevtag,    NULL },
     { MODKEY|ShiftMask,        XK_space,    togglefloating,    NULL },
diff --git a/dwm.c b/dwm.c
@@ -153,6 +153,7 @@ void killclient(const char *arg);
 void manage(Window w, XWindowAttributes *wa);
 void mappingnotify(XEvent *e);
 void maprequest(XEvent *e);
+void monocle(void);
 void movemouse(Client *c);
 Client *nexttiled(Client *c);
 void propertynotify(XEvent *e);
@@ -1072,6 +1073,16 @@ maprequest(XEvent *e) {
 }
 
 void
+monocle(void) {
+    Client *c;
+
+    domwfact = dozoom = False;
+    for(c = clients; c; c = c->next)
+        if(isvisible(c))
+            resize(c, wax, way, waw - 2 * c->border, wah - 2 * c->border, RESIZEHINTS);
+}
+
+void
 movemouse(Client *c) {
     int x1, y1, ocx, ocy, di, nx, ny;
     unsigned int dui;
@@ -1412,7 +1423,7 @@ setlayout(const char *arg) {
     }
     else {
         for(i = 0; i < LENGTH(layouts); i++)
-            if(arg == layouts[i].symbol)
+            if(!strcmp(arg, layouts[i].symbol))
                 break;
         if(i == LENGTH(layouts))
             return;