tchanged shortcuts as described on the mailinglist, added sanity checks for rat… | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 796925089cff58fbea4a1954cf0df57a6a648562 | |
parent da91dfc948e3c66ac491bbdd1424a33aadbb5265 | |
Author: Anselm R. Garbe <[email protected]> | |
Date: Sun, 5 Aug 2007 12:47:52 +0200 | |
changed shortcuts as described on the mailinglist, added sanity checks for rati… | |
Diffstat: | |
M config.arg.h | 14 +++++++------- | |
M config.default.h | 10 ++++++---- | |
M dwm.1 | 18 ++++++++++++------ | |
M layout.c | 53 ++++++++++++++++++++---------… | |
4 files changed, 60 insertions(+), 35 deletions(-) | |
--- | |
diff --git a/config.arg.h b/config.arg.h | |
t@@ -32,7 +32,7 @@ static Layout layout[] = { \ | |
}; | |
#define NMASTER 1 /* clients in master area */ | |
#define HRATIO .8 /* horizontal ratio of tile */ | |
-#define VRATIO .8 /* vertical ratio of tile */ | |
+#define VRATIO .9 /* vertical ratio of tile */ | |
#define SNAP 32 /* snap pixel */ | |
/* key definitions */ | |
t@@ -47,14 +47,14 @@ static Key key[] = { \ | |
"exec urxvtcd -tr -bg '#222' -fg '#eee' -cr '#eee' +sb -fn '"F… | |
{ MODKEY, XK_space, setlayout, NU… | |
{ MODKEY, XK_b, togglebar, … | |
- { MODKEY, XK_h, incvratio, … | |
- { MODKEY, XK_h, inchratio, … | |
- { MODKEY, XK_l, incvratio, … | |
- { MODKEY, XK_l, inchratio, … | |
- { MODKEY|ShiftMask, XK_j, incnmaster, … | |
- { MODKEY|ShiftMask, XK_k, incnmaster, … | |
+ { MODKEY, XK_h, incnmaster, … | |
+ { MODKEY, XK_l, incnmaster, … | |
{ MODKEY, XK_j, focusclient, … | |
{ MODKEY, XK_k, focusclient, … | |
+ { MODKEY|ShiftMask, XK_h, inchratio, … | |
+ { MODKEY|ShiftMask, XK_l, inchratio, … | |
+ { MODKEY|ShiftMask, XK_j, incvratio, … | |
+ { MODKEY|ShiftMask, XK_k, incvratio, … | |
{ MODKEY, XK_m, togglemax, … | |
{ MODKEY, XK_Return, zoom, … | |
{ MODKEY|ShiftMask, XK_space, togglefloating, … | |
diff --git a/config.default.h b/config.default.h | |
t@@ -45,12 +45,14 @@ static Key key[] = { \ | |
{ MODKEY, XK_p, spawn, … | |
{ MODKEY, XK_space, setlayout, NU… | |
{ MODKEY, XK_b, togglebar, … | |
- { MODKEY, XK_h, incvratio, … | |
- { MODKEY, XK_l, incvratio, … | |
- { MODKEY|ShiftMask, XK_j, incnmaster, … | |
- { MODKEY|ShiftMask, XK_k, incnmaster, … | |
+ { MODKEY, XK_h, incnmaster, … | |
+ { MODKEY, XK_l, incnmaster, … | |
{ MODKEY, XK_j, focusclient, … | |
{ MODKEY, XK_k, focusclient, … | |
+ { MODKEY|ShiftMask, XK_h, inchratio, … | |
+ { MODKEY|ShiftMask, XK_l, inchratio, … | |
+ { MODKEY|ShiftMask, XK_j, incvratio, … | |
+ { MODKEY|ShiftMask, XK_k, incvratio, … | |
{ MODKEY, XK_m, togglemax, … | |
{ MODKEY, XK_Return, zoom, … | |
{ MODKEY|ShiftMask, XK_space, togglefloating, … | |
diff --git a/dwm.1 b/dwm.1 | |
t@@ -68,17 +68,23 @@ Focus next window. | |
.B Mod1\-k | |
Focus previous window. | |
.TP | |
-.B Mod1\-Shift\-j | |
+.B Mod1\-l | |
Increase the number of windows in the master area (tiled layout only). | |
.TP | |
-.B Mod1\-Shift\-k | |
+.B Mod1\-h | |
Decrease the number of windows in the master area (tiled layout only). | |
.TP | |
-.B Mod1\-l | |
-Increase master area width (tiled layout only). | |
+.B Mod1\-Shift\-j | |
+Increase vertical tile ratio, effects tile heights (tiled layout only). | |
.TP | |
-.B Mod1\-h | |
-Decrease master area width (tiled layout only). | |
+.B Mod1\-Shift\-k | |
+Decrease vertical tile ratio, effects tile heights (tiled layout only). | |
+.TP | |
+.B Mod1\-Shift\-l | |
+Increase horizontal tile ratio, effects master area width (tiled layout only). | |
+.TP | |
+.B Mod1\-Shift\-h | |
+Decrease horizontal tile ratio, effects master area width (tiled layout only). | |
.TP | |
.B Mod1\-m | |
Toggles maximization of current window (floating layout only). | |
diff --git a/layout.c b/layout.c | |
t@@ -25,21 +25,27 @@ spow(double x, double y) | |
static void | |
tile(void) { | |
- double mscale = 0, tscale = 0, sum = 0; | |
+ Bool mmaxtile = False, smaxtile = False; /* fallback tiling */ | |
+ double mscale = 0, sscale = 0, sum = 0; | |
unsigned int i, n, nx, ny, nw, nh, mw, tw; | |
Client *c; | |
+ /* preparation */ | |
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) | |
n++; | |
- | |
+ nx = wax; | |
+ ny = way; | |
mw = (n <= nmaster) ? waw : waw / (1 + hratio); | |
tw = waw - mw; | |
- | |
if(n > 0) { | |
- if(n < nmaster) { | |
+ if(n <= nmaster) { | |
for(i = 0; i < n; i++) | |
sum += spow(vratio, i); | |
mscale = wah / sum; | |
+ if(vratio >= 1) | |
+ mmaxtile = bh > (mscale * spow(vratio, 0)); | |
+ else | |
+ mmaxtile = bh > (mscale * spow(vratio, n - 1)); | |
} | |
else { | |
for(i = 0; i < nmaster; i++) | |
t@@ -47,11 +53,18 @@ tile(void) { | |
mscale = wah / sum; | |
for(sum = 0, i = 0; i < (n - nmaster); i++) | |
sum += spow(vratio, i); | |
- tscale = wah / sum; | |
+ sscale = wah / sum; | |
+ if(vratio >= 1) { | |
+ mmaxtile = bh > (mscale * spow(vratio, 0)); | |
+ smaxtile = bh > (sscale * spow(vratio, 0)); | |
+ } | |
+ else { | |
+ mmaxtile = bh > (mscale * spow(vratio, nmaster… | |
+ smaxtile = bh > (sscale * spow(vratio, n - nma… | |
+ } | |
} | |
} | |
- nx = wax; | |
- ny = way; | |
+ /* tiling */ | |
for(i = 0, c = clients; c; c = c->next) | |
if(isvisible(c)) { | |
unban(c); | |
t@@ -60,25 +73,29 @@ tile(void) { | |
c->ismax = False; | |
if(i < nmaster) { /* master window */ | |
nw = mw - 2 * c->border; | |
- if(i + 1 == n || i + 1 == nmaster) | |
- nh = (way + wah) - ny - (2 * c->border… | |
+ if(mmaxtile) { | |
+ ny = way; | |
+ nh = wah - 2 * c->border; | |
+ } | |
+ else if(i + 1 == (n < nmaster ? n : nmaster)) | |
+ nh = (way + wah) - ny - 2 * c->border; | |
else | |
- nh = (mscale * spow(vratio, i)) - (2 *… | |
+ nh = (mscale * spow(vratio, i)) - 2 * … | |
} | |
else { /* tile window */ | |
+ nw = tw - 2 * c->border; | |
if(i == nmaster) { | |
ny = way; | |
nx = wax + mw; | |
} | |
- nw = tw - 2 * c->border; | |
- if(i + 1 == n) | |
- nh = (way + wah) - ny - (2 * c->border… | |
+ if(smaxtile) { | |
+ ny = way; | |
+ nh = wah - 2 * c->border; | |
+ } | |
+ else if(i + 1 == n) | |
+ nh = (way + wah) - ny - 2 * c->border; | |
else | |
- nh = (tscale * spow(vratio, i - nmaste… | |
- } | |
- if(nh < bh) { | |
- nh = bh; | |
- ny = way + wah - nh; | |
+ nh = (sscale * spow(vratio, i - nmaste… | |
} | |
resize(c, nx, ny, nw, nh, False); | |
ny += nh; |