diff options
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 49 |
1 files changed, 39 insertions, 10 deletions
| @@ -1,6 +1,3 @@ | |||
| 1 | /** | ||
| 2 | * - allow for vstack | ||
| 3 | */ | ||
| 4 | /* See LICENSE file for copyright and license details. | 1 | /* See LICENSE file for copyright and license details. |
| 5 | * | 2 | * |
| 6 | * dynamic window manager is designed like any other X client as well. It is | 3 | * dynamic window manager is designed like any other X client as well. It is |
| @@ -36,7 +33,6 @@ | |||
| 36 | #include <sys/select.h> | 33 | #include <sys/select.h> |
| 37 | #include <sys/types.h> | 34 | #include <sys/types.h> |
| 38 | #include <sys/wait.h> | 35 | #include <sys/wait.h> |
| 39 | #include <regex.h> | ||
| 40 | #include <X11/cursorfont.h> | 36 | #include <X11/cursorfont.h> |
| 41 | #include <X11/keysym.h> | 37 | #include <X11/keysym.h> |
| 42 | #include <X11/Xatom.h> | 38 | #include <X11/Xatom.h> |
| @@ -170,8 +166,10 @@ void spawn(const char *arg); | |||
| 170 | void tag(const char *arg); | 166 | void tag(const char *arg); |
| 171 | unsigned int textnw(const char *text, unsigned int len); | 167 | unsigned int textnw(const char *text, unsigned int len); |
| 172 | unsigned int textw(const char *text); | 168 | unsigned int textw(const char *text); |
| 173 | void tile(void); | 169 | void tileh(void); |
| 170 | void tilehstack(unsigned int n); | ||
| 174 | unsigned int tilemaster(void); | 171 | unsigned int tilemaster(void); |
| 172 | void tilev(void); | ||
| 175 | void tilevstack(unsigned int n); | 173 | void tilevstack(unsigned int n); |
| 176 | void togglefloating(const char *arg); | 174 | void togglefloating(const char *arg); |
| 177 | void toggletag(const char *arg); | 175 | void toggletag(const char *arg); |
| @@ -1547,6 +1545,37 @@ tileresize(Client *c, int x, int y, int w, int h) { | |||
| 1547 | resize(c, x, y, w, h, False); | 1545 | resize(c, x, y, w, h, False); |
| 1548 | } | 1546 | } |
| 1549 | 1547 | ||
| 1548 | void | ||
| 1549 | tileh(void) { | ||
| 1550 | tilehstack(tilemaster()); | ||
| 1551 | } | ||
| 1552 | |||
| 1553 | void | ||
| 1554 | tilehstack(unsigned int n) { | ||
| 1555 | int i, x, w; | ||
| 1556 | Client *c; | ||
| 1557 | |||
| 1558 | if(n == 0) | ||
| 1559 | return; | ||
| 1560 | |||
| 1561 | x = TX; | ||
| 1562 | w = (TW) / n; | ||
| 1563 | if(w < bh) | ||
| 1564 | w = TW; | ||
| 1565 | |||
| 1566 | for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) | ||
| 1567 | if(i > 0) { | ||
| 1568 | if(i > 1 && i == n) /* remainder */ | ||
| 1569 | tileresize(c, x, TY, ((TX) + (TW)) - x - 2 * c->border, | ||
| 1570 | TH - 2 * c->border); | ||
| 1571 | else | ||
| 1572 | tileresize(c, x, TY, w - 2 * c->border, | ||
| 1573 | TH - 2 * c->border); | ||
| 1574 | if(w != TW) | ||
| 1575 | x = c->x + c->w + 2 * c->border; | ||
| 1576 | } | ||
| 1577 | } | ||
| 1578 | |||
| 1550 | unsigned int | 1579 | unsigned int |
| 1551 | tilemaster(void) { | 1580 | tilemaster(void) { |
| 1552 | unsigned int n; | 1581 | unsigned int n; |
| @@ -1564,6 +1593,11 @@ tilemaster(void) { | |||
| 1564 | } | 1593 | } |
| 1565 | 1594 | ||
| 1566 | void | 1595 | void |
| 1596 | tilev(void) { | ||
| 1597 | tilevstack(tilemaster()); | ||
| 1598 | } | ||
| 1599 | |||
| 1600 | void | ||
| 1567 | tilevstack(unsigned int n) { | 1601 | tilevstack(unsigned int n) { |
| 1568 | int i, y, h; | 1602 | int i, y, h; |
| 1569 | Client *c; | 1603 | Client *c; |
| @@ -1590,11 +1624,6 @@ tilevstack(unsigned int n) { | |||
| 1590 | } | 1624 | } |
| 1591 | 1625 | ||
| 1592 | void | 1626 | void |
| 1593 | tile(void) { | ||
| 1594 | tilevstack(tilemaster()); | ||
| 1595 | } | ||
| 1596 | |||
| 1597 | void | ||
| 1598 | togglefloating(const char *arg) { | 1627 | togglefloating(const char *arg) { |
| 1599 | if(!sel) | 1628 | if(!sel) |
| 1600 | return; | 1629 | return; |
