diff options
| author | Anselm R Garbe <garbeam@gmail.com> | 2008-06-19 11:38:53 +0100 |
|---|---|---|
| committer | Anselm R Garbe <garbeam@gmail.com> | 2008-06-19 11:38:53 +0100 |
| commit | 12ea925076c4f1c013502651b0be90c05e0febac (patch) | |
| tree | 520c17c2ee82e7f9025be27576c26ccdea428c94 | |
| parent | non-zero (diff) | |
| download | dwm-12ea925076c4f1c013502651b0be90c05e0febac.tar.gz dwm-12ea925076c4f1c013502651b0be90c05e0febac.zip | |
untested monocle
| -rw-r--r-- | config.def.h | 15 | ||||
| -rw-r--r-- | config.mk | 2 | ||||
| -rw-r--r-- | dwm.1 | 11 | ||||
| -rw-r--r-- | dwm.c | 72 |
4 files changed, 55 insertions, 45 deletions
diff --git a/config.def.h b/config.def.h index d2c5318..6cf3989 100644 --- a/config.def.h +++ b/config.def.h | |||
| @@ -32,8 +32,9 @@ static Bool resizehints = True; /* False means respect size hints in tiled resiz | |||
| 32 | 32 | ||
| 33 | static Layout layouts[] = { | 33 | static Layout layouts[] = { |
| 34 | /* symbol arrange function */ | 34 | /* symbol arrange function */ |
| 35 | { "[]=", tile }, /* first entry is default */ | 35 | { "[]=", tile }, /* first entry is default */ |
| 36 | { "><>", NULL }, /* no layout function means floating behavior */ | 36 | { "><>", NULL }, /* no layout function means floating behavior */ |
| 37 | { "[M]", monocle }, /* first entry is default */ | ||
| 37 | }; | 38 | }; |
| 38 | 39 | ||
| 39 | /* key definitions */ | 40 | /* key definitions */ |
| @@ -60,11 +61,13 @@ static Key keys[] = { | |||
| 60 | { MODKEY, XK_k, focusstack, {.i = -1 } }, | 61 | { MODKEY, XK_k, focusstack, {.i = -1 } }, |
| 61 | { MODKEY, XK_h, setmfact, {.f = -0.05} }, | 62 | { MODKEY, XK_h, setmfact, {.f = -0.05} }, |
| 62 | { MODKEY, XK_l, setmfact, {.f = +0.05} }, | 63 | { MODKEY, XK_l, setmfact, {.f = +0.05} }, |
| 63 | { MODKEY, XK_m, togglemax, {0} }, | ||
| 64 | { MODKEY, XK_Return, zoom, {0} }, | 64 | { MODKEY, XK_Return, zoom, {0} }, |
| 65 | { MODKEY, XK_Tab, view, {0} }, | 65 | { MODKEY, XK_Tab, view, {0} }, |
| 66 | { MODKEY|ShiftMask, XK_c, killclient, {0} }, | 66 | { MODKEY|ShiftMask, XK_c, killclient, {0} }, |
| 67 | { MODKEY, XK_space, togglelayout, {0} }, | 67 | { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, |
| 68 | { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, | ||
| 69 | { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, | ||
| 70 | { MODKEY, XK_space, setlayout, {0} }, | ||
| 68 | { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, | 71 | { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, |
| 69 | { MODKEY, XK_0, view, {.ui = ~0 } }, | 72 | { MODKEY, XK_0, view, {.ui = ~0 } }, |
| 70 | { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, | 73 | { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, |
| @@ -91,8 +94,8 @@ static Key keys[] = { | |||
| 91 | * ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ | 94 | * ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ |
| 92 | static Button buttons[] = { | 95 | static Button buttons[] = { |
| 93 | /* click event mask button function argument */ | 96 | /* click event mask button function argument */ |
| 94 | { ClkLtSymbol, 0, Button1, togglelayout, {0} }, | 97 | { ClkLtSymbol, 0, Button1, setlayout, {0} }, |
| 95 | { ClkLtSymbol, 0, Button3, togglemax, {0} }, | 98 | { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, |
| 96 | { ClkWinTitle, 0, Button2, zoom, {0} }, | 99 | { ClkWinTitle, 0, Button2, zoom, {0} }, |
| 97 | { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, | 100 | { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, |
| 98 | { ClkClientWin, MODKEY, Button1, movemouse, {0} }, | 101 | { ClkClientWin, MODKEY, Button1, movemouse, {0} }, |
| @@ -1,5 +1,5 @@ | |||
| 1 | # dwm version | 1 | # dwm version |
| 2 | VERSION = 5.0.1 | 2 | VERSION = 5.1 |
| 3 | 3 | ||
| 4 | # Customize below to fit your system | 4 | # Customize below to fit your system |
| 5 | 5 | ||
| @@ -60,8 +60,17 @@ Start | |||
| 60 | .B Mod1\-b | 60 | .B Mod1\-b |
| 61 | Toggles bar on and off. | 61 | Toggles bar on and off. |
| 62 | .TP | 62 | .TP |
| 63 | .B Mod1\-t | ||
| 64 | Sets tiled layout. | ||
| 65 | .TP | ||
| 66 | .B Mod1\-f | ||
| 67 | Sets floating layout. | ||
| 68 | .TP | ||
| 69 | .B Mod1\-f | ||
| 70 | Sets monocle layout. | ||
| 71 | .TP | ||
| 63 | .B Mod1\-space | 72 | .B Mod1\-space |
| 64 | Toggles between layouts. | 73 | Toggles between current and previous layout. |
| 65 | .TP | 74 | .TP |
| 66 | .B Mod1\-j | 75 | .B Mod1\-j |
| 67 | Focus next window. | 76 | Focus next window. |
| @@ -89,7 +89,7 @@ struct Client { | |||
| 89 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; | 89 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
| 90 | int bw, oldbw; | 90 | int bw, oldbw; |
| 91 | uint tags; | 91 | uint tags; |
| 92 | Bool isbanned, isfixed, isfloating, ismoved, isurgent; | 92 | Bool isbanned, isfixed, isfloating, isurgent; |
| 93 | Client *next; | 93 | Client *next; |
| 94 | Client *snext; | 94 | Client *snext; |
| 95 | Window win; | 95 | Window win; |
| @@ -168,6 +168,7 @@ static void killclient(const Arg *arg); | |||
| 168 | static void manage(Window w, XWindowAttributes *wa); | 168 | static void manage(Window w, XWindowAttributes *wa); |
| 169 | static void mappingnotify(XEvent *e); | 169 | static void mappingnotify(XEvent *e); |
| 170 | static void maprequest(XEvent *e); | 170 | static void maprequest(XEvent *e); |
| 171 | static void monocle(void); | ||
| 171 | static void movemouse(const Arg *arg); | 172 | static void movemouse(const Arg *arg); |
| 172 | static Client *nexttiled(Client *c); | 173 | static Client *nexttiled(Client *c); |
| 173 | static void propertynotify(XEvent *e); | 174 | static void propertynotify(XEvent *e); |
| @@ -178,6 +179,7 @@ static void restack(void); | |||
| 178 | static void run(void); | 179 | static void run(void); |
| 179 | static void scan(void); | 180 | static void scan(void); |
| 180 | static void setclientstate(Client *c, long state); | 181 | static void setclientstate(Client *c, long state); |
| 182 | static void setlayout(const Arg *arg); | ||
| 181 | static void setmfact(const Arg *arg); | 183 | static void setmfact(const Arg *arg); |
| 182 | static void setup(void); | 184 | static void setup(void); |
| 183 | static void spawn(const Arg *arg); | 185 | static void spawn(const Arg *arg); |
| @@ -186,8 +188,6 @@ static int textnw(const char *text, uint len); | |||
| 186 | static void tile(void); | 188 | static void tile(void); |
| 187 | static void togglebar(const Arg *arg); | 189 | static void togglebar(const Arg *arg); |
| 188 | static void togglefloating(const Arg *arg); | 190 | static void togglefloating(const Arg *arg); |
| 189 | static void togglelayout(const Arg *arg); | ||
| 190 | static void togglemax(const Arg *arg); | ||
| 191 | static void toggletag(const Arg *arg); | 191 | static void toggletag(const Arg *arg); |
| 192 | static void toggleview(const Arg *arg); | 192 | static void toggleview(const Arg *arg); |
| 193 | static void unmanage(Client *c); | 193 | static void unmanage(Client *c); |
| @@ -225,7 +225,6 @@ static void (*handler[LASTEvent]) (XEvent *) = { | |||
| 225 | [UnmapNotify] = unmapnotify | 225 | [UnmapNotify] = unmapnotify |
| 226 | }; | 226 | }; |
| 227 | static Atom wmatom[WMLast], netatom[NetLast]; | 227 | static Atom wmatom[WMLast], netatom[NetLast]; |
| 228 | static Bool ismax = False; | ||
| 229 | static Bool otherwm, readin; | 228 | static Bool otherwm, readin; |
| 230 | static Bool running = True; | 229 | static Bool running = True; |
| 231 | static uint tagset[] = {1, 1}; /* after start, first tag is selected */ | 230 | static uint tagset[] = {1, 1}; /* after start, first tag is selected */ |
| @@ -275,21 +274,17 @@ arrange(void) { | |||
| 275 | 274 | ||
| 276 | for(c = clients; c; c = c->next) | 275 | for(c = clients; c; c = c->next) |
| 277 | if(c->tags & tagset[seltags]) { /* is visible */ | 276 | if(c->tags & tagset[seltags]) { /* is visible */ |
| 278 | if(ismax && !c->isfixed) { | 277 | if(!lt->arrange || c->isfloating) |
| 279 | XMoveResizeWindow(dpy, c->win, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw); | ||
| 280 | c->ismoved = True; | ||
| 281 | } | ||
| 282 | else if(!lt->arrange || c->isfloating) | ||
| 283 | resize(c, c->x, c->y, c->w, c->h, True); | 278 | resize(c, c->x, c->y, c->w, c->h, True); |
| 284 | c->isbanned = False; | 279 | c->isbanned = False; |
| 285 | } | 280 | } |
| 286 | else if(!c->isbanned) { | 281 | else if(!c->isbanned) { |
| 287 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | 282 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
| 288 | c->isbanned = c->ismoved = True; | 283 | c->isbanned = True; |
| 289 | } | 284 | } |
| 290 | 285 | ||
| 291 | focus(NULL); | 286 | focus(NULL); |
| 292 | if(lt->arrange && !ismax) | 287 | if(lt->arrange) |
| 293 | lt->arrange(); | 288 | lt->arrange(); |
| 294 | restack(); | 289 | restack(); |
| 295 | } | 290 | } |
| @@ -418,8 +413,6 @@ configurerequest(XEvent *e) { | |||
| 418 | if((c = getclient(ev->window))) { | 413 | if((c = getclient(ev->window))) { |
| 419 | if(ev->value_mask & CWBorderWidth) | 414 | if(ev->value_mask & CWBorderWidth) |
| 420 | c->bw = ev->border_width; | 415 | c->bw = ev->border_width; |
| 421 | if(ismax && !c->isbanned && !c->isfixed) | ||
| 422 | XMoveResizeWindow(dpy, c->win, wx, wy, ww - 2 * c->bw, wh + 2 * c->bw); | ||
| 423 | else if(c->isfloating || !lt->arrange) { | 416 | else if(c->isfloating || !lt->arrange) { |
| 424 | if(ev->value_mask & CWX) | 417 | if(ev->value_mask & CWX) |
| 425 | c->x = sx + ev->x; | 418 | c->x = sx + ev->x; |
| @@ -507,7 +500,7 @@ drawbar(void) { | |||
| 507 | } | 500 | } |
| 508 | if(blw > 0) { | 501 | if(blw > 0) { |
| 509 | dc.w = blw; | 502 | dc.w = blw; |
| 510 | drawtext(lt->symbol, dc.norm, ismax); | 503 | drawtext(lt->symbol, dc.norm, False); |
| 511 | x = dc.x + dc.w; | 504 | x = dc.x + dc.w; |
| 512 | } | 505 | } |
| 513 | else | 506 | else |
| @@ -967,6 +960,14 @@ maprequest(XEvent *e) { | |||
| 967 | } | 960 | } |
| 968 | 961 | ||
| 969 | void | 962 | void |
| 963 | monocle(void) { | ||
| 964 | Client *c; | ||
| 965 | |||
| 966 | for(c = nexttiled(clients); c; c = nexttiled(c->next)) | ||
| 967 | resize(c, wx, wy, ww, wh, resizehints); | ||
| 968 | } | ||
| 969 | |||
| 970 | void | ||
| 970 | movemouse(const Arg *arg) { | 971 | movemouse(const Arg *arg) { |
| 971 | int x1, y1, ocx, ocy, di, nx, ny; | 972 | int x1, y1, ocx, ocy, di, nx, ny; |
| 972 | uint dui; | 973 | uint dui; |
| @@ -1115,8 +1116,7 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) { | |||
| 1115 | h = bh; | 1116 | h = bh; |
| 1116 | if(w < bh) | 1117 | if(w < bh) |
| 1117 | w = bh; | 1118 | w = bh; |
| 1118 | if(c->x != x || c->y != y || c->w != w || c->h != h || c->ismoved) { | 1119 | if(c->x != x || c->y != y || c->w != w || c->h != h) { |
| 1119 | c->ismoved = False; | ||
| 1120 | c->x = wc.x = x; | 1120 | c->x = wc.x = x; |
| 1121 | c->y = wc.y = y; | 1121 | c->y = wc.y = y; |
| 1122 | c->w = wc.width = w; | 1122 | c->w = wc.width = w; |
| @@ -1186,9 +1186,9 @@ restack(void) { | |||
| 1186 | drawbar(); | 1186 | drawbar(); |
| 1187 | if(!sel) | 1187 | if(!sel) |
| 1188 | return; | 1188 | return; |
| 1189 | if(ismax || sel->isfloating || !lt->arrange) | 1189 | if(sel->isfloating || !lt->arrange) |
| 1190 | XRaiseWindow(dpy, sel->win); | 1190 | XRaiseWindow(dpy, sel->win); |
| 1191 | if(!ismax && lt->arrange) { | 1191 | if(lt->arrange) { |
| 1192 | wc.stack_mode = Below; | 1192 | wc.stack_mode = Below; |
| 1193 | wc.sibling = barwin; | 1193 | wc.sibling = barwin; |
| 1194 | for(c = stack; c; c = c->snext) | 1194 | for(c = stack; c; c = c->snext) |
| @@ -1296,6 +1296,22 @@ setclientstate(Client *c, long state) { | |||
| 1296 | PropModeReplace, (unsigned char *)data, 2); | 1296 | PropModeReplace, (unsigned char *)data, 2); |
| 1297 | } | 1297 | } |
| 1298 | 1298 | ||
| 1299 | void | ||
| 1300 | setlayout(const Arg *arg) { | ||
| 1301 | static Layout *prevlt = &layouts[1 % LENGTH(layouts)]; | ||
| 1302 | |||
| 1303 | if(!arg || !arg->v || arg->v == lt) | ||
| 1304 | lt = prevlt; | ||
| 1305 | else { | ||
| 1306 | prevlt = lt; | ||
| 1307 | lt = (Layout *)arg->v; | ||
| 1308 | } | ||
| 1309 | if(sel) | ||
| 1310 | arrange(); | ||
| 1311 | else | ||
| 1312 | drawbar(); | ||
| 1313 | } | ||
| 1314 | |||
| 1299 | /* arg > 1.0 will set mfact absolutly */ | 1315 | /* arg > 1.0 will set mfact absolutly */ |
| 1300 | void | 1316 | void |
| 1301 | setmfact(const Arg *arg) { | 1317 | setmfact(const Arg *arg) { |
| @@ -1477,24 +1493,6 @@ togglefloating(const Arg *arg) { | |||
| 1477 | } | 1493 | } |
| 1478 | 1494 | ||
| 1479 | void | 1495 | void |
| 1480 | togglelayout(const Arg *arg) { | ||
| 1481 | if(arg && arg->v) | ||
| 1482 | lt = (Layout *)arg->v; | ||
| 1483 | else if(++lt == &layouts[LENGTH(layouts)]) | ||
| 1484 | lt = &layouts[0]; | ||
| 1485 | if(sel) | ||
| 1486 | arrange(); | ||
| 1487 | else | ||
| 1488 | drawbar(); | ||
| 1489 | } | ||
| 1490 | |||
| 1491 | void | ||
| 1492 | togglemax(const Arg *arg) { | ||
| 1493 | ismax = !ismax; | ||
| 1494 | arrange(); | ||
| 1495 | } | ||
| 1496 | |||
| 1497 | void | ||
| 1498 | toggletag(const Arg *arg) { | 1496 | toggletag(const Arg *arg) { |
| 1499 | uint mask = sel->tags ^ (arg->ui & TAGMASK); | 1497 | uint mask = sel->tags ^ (arg->ui & TAGMASK); |
| 1500 | 1498 | ||
| @@ -1693,7 +1691,7 @@ void | |||
| 1693 | zoom(const Arg *arg) { | 1691 | zoom(const Arg *arg) { |
| 1694 | Client *c = sel; | 1692 | Client *c = sel; |
| 1695 | 1693 | ||
| 1696 | if(ismax || !lt->arrange || (sel && sel->isfloating)) | 1694 | if(!lt->arrange || lt->arrange == monocle || (sel && sel->isfloating)) |
| 1697 | return; | 1695 | return; |
| 1698 | if(c == nexttiled(clients)) | 1696 | if(c == nexttiled(clients)) |
| 1699 | if(!c || !(c = nexttiled(c->next))) | 1697 | if(!c || !(c = nexttiled(c->next))) |
