summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-03-06 19:20:14 +0000
committerAnselm R Garbe <garbeam@gmail.com>2008-03-06 19:20:14 +0000
commitd7b074fcce4877ed404f6a92671689fcdee9133b (patch)
tree9fec0fcfda5c9d32eb74782bfe7ddd5362187380 /dwm.c
parentimplemented setlayout in the way proposed on the ml, split tile() into two fu... (diff)
downloaddwm-d7b074fcce4877ed404f6a92671689fcdee9133b.tar.gz
dwm-d7b074fcce4877ed404f6a92671689fcdee9133b.zip
new stuff
Diffstat (limited to '')
-rw-r--r--dwm.c49
1 files changed, 39 insertions, 10 deletions
diff --git a/dwm.c b/dwm.c
index 2985cea..f51d801 100644
--- a/dwm.c
+++ b/dwm.c
@@ -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);
170void tag(const char *arg); 166void tag(const char *arg);
171unsigned int textnw(const char *text, unsigned int len); 167unsigned int textnw(const char *text, unsigned int len);
172unsigned int textw(const char *text); 168unsigned int textw(const char *text);
173void tile(void); 169void tileh(void);
170void tilehstack(unsigned int n);
174unsigned int tilemaster(void); 171unsigned int tilemaster(void);
172void tilev(void);
175void tilevstack(unsigned int n); 173void tilevstack(unsigned int n);
176void togglefloating(const char *arg); 174void togglefloating(const char *arg);
177void toggletag(const char *arg); 175void 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
1548void
1549tileh(void) {
1550 tilehstack(tilemaster());
1551}
1552
1553void
1554tilehstack(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
1550unsigned int 1579unsigned int
1551tilemaster(void) { 1580tilemaster(void) {
1552 unsigned int n; 1581 unsigned int n;
@@ -1564,6 +1593,11 @@ tilemaster(void) {
1564} 1593}
1565 1594
1566void 1595void
1596tilev(void) {
1597 tilevstack(tilemaster());
1598}
1599
1600void
1567tilevstack(unsigned int n) { 1601tilevstack(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
1592void 1626void
1593tile(void) {
1594 tilevstack(tilemaster());
1595}
1596
1597void
1598togglefloating(const char *arg) { 1627togglefloating(const char *arg) {
1599 if(!sel) 1628 if(!sel)
1600 return; 1629 return;