{ "><>", floating }, \
};
#define NMASTER 1 /* clients in master area */
-#define RATIO .8 /* ratio of tile */
+#define HRATIO .8 /* horizontal ratio of tile */
+#define VRATIO .8 /* vertical ratio of tile */
#define SNAP 32 /* snap pixel */
/* key definitions */
"exec urxvtcd -tr -bg '#222' -fg '#eee' -cr '#eee' +sb -fn '"FONT"'" }, \
{ MODKEY, XK_space, setlayout, NULL }, \
{ MODKEY, XK_b, togglebar, NULL }, \
- { MODKEY, XK_h, incratio, ".1" }, \
- { MODKEY, XK_l, incratio, "-.1" }, \
+ { MODKEY, XK_h, incvratio, ".1" }, \
+ { MODKEY, XK_h, inchratio, ".1" }, \
+ { MODKEY, XK_l, incvratio, "-.1" }, \
+ { MODKEY, XK_l, inchratio, "-.1" }, \
{ MODKEY|ShiftMask, XK_j, incnmaster, "1" }, \
{ MODKEY|ShiftMask, XK_k, incnmaster, "-1" }, \
{ MODKEY, XK_j, focusclient, "1" }, \
{ "><>", floating }, \
};
#define NMASTER 1 /* clients in master area */
-#define RATIO .8 /* ratio of tile */
+#define HRATIO .8 /* horizontal ratio of tile */
+#define VRATIO 1 /* vertical ratio of tile */
#define SNAP 32 /* snap pixel */
/* key definitions */
{ MODKEY, XK_p, spawn, "exe=`dmenu_path | dmenu` && exec $exe" }, \
{ MODKEY, XK_space, setlayout, NULL }, \
{ MODKEY, XK_b, togglebar, NULL }, \
- { MODKEY, XK_h, incratio, ".1" }, \
- { MODKEY, XK_l, incratio, "-.1" }, \
+ { MODKEY, XK_h, incvratio, ".1" }, \
+ { MODKEY, XK_l, incvratio, "-.1" }, \
{ MODKEY|ShiftMask, XK_j, incnmaster, "1" }, \
{ MODKEY|ShiftMask, XK_k, incnmaster, "-1" }, \
{ MODKEY, XK_j, focusclient, "1" }, \
typedef struct Client Client;
struct Client {
char name[256];
- float scale;
int x, y, w, h;
int rx, ry, rw, rh; /* revert geometry */
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
/* layout.c */
void floating(void); /* arranges all windows floating */
void focusclient(const char *arg); /* focuses next(1)/previous(-1) visible client */
-void incratio(const char *arg); /* increments the tile ratio with arg's value */
+void inchratio(const char *arg); /* increments the horizontal tile ratio with arg's value */
+void incvratio(const char *arg); /* increments the vertical tile ratio with arg's value */
void incnmaster(const char *arg); /* increments nmaster with arg's index value */
void initlayouts(void); /* initialize layout array */
Client *nexttiled(Client *c); /* returns tiled successor of c */
/* static */
-static double ratio = RATIO;
+static double hratio = HRATIO;
+static double vratio = VRATIO;
static unsigned int nlayouts = 0;
static unsigned int nmaster = NMASTER;
+static void
+incratio(const char *arg, double *ratio, double def) {
+ double delta;
+
+ if(lt->arrange != tile)
+ return;
+ if(!arg)
+ *ratio = def;
+ else {
+ if(1 == sscanf(arg, "%lf", &delta)) {
+ if(delta + (*ratio) < .1 || delta + (*ratio) > 1.9)
+ return;
+ *ratio += delta;
+ }
+ }
+ lt->arrange();
+}
+
static double /* simple pow() */
spow(double x, double y)
{
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
n++;
- mw = (n <= nmaster) ? waw : waw / (1 + ratio);
+ mw = (n <= nmaster) ? waw : waw / (1 + hratio);
tw = waw - mw;
if(n > 0) {
if(n < nmaster) {
for(i = 0; i < n; i++)
- sum += spow(ratio, i);
+ sum += spow(vratio, i);
mscale = wah / sum;
}
else {
for(i = 0; i < nmaster; i++)
- sum += spow(ratio, i);
+ sum += spow(vratio, i);
mscale = wah / sum;
for(sum = 0, i = 0; i < (n - nmaster); i++)
- sum += spow(ratio, i);
+ sum += spow(vratio, i);
tscale = wah / sum;
}
}
if(i + 1 == n || i + 1 == nmaster)
nh = (way + wah) - ny - (2 * c->border);
else
- nh = (mscale * spow(ratio, i)) - (2 * c->border);
+ nh = (mscale * spow(vratio, i)) - (2 * c->border);
}
else { /* tile window */
if(i == nmaster) {
if(i + 1 == n)
nh = (way + wah) - ny - (2 * c->border);
else
- nh = (tscale * spow(ratio, i - nmaster)) - (2 * c->border);
+ nh = (tscale * spow(vratio, i - nmaster)) - (2 * c->border);
}
if(nh < bh) {
nh = bh;
}
void
-incratio(const char *arg) {
- double delta;
+inchratio(const char *arg) {
+ incratio(arg, &hratio, HRATIO);
+}
- if(lt->arrange != tile)
- return;
- if(!arg)
- ratio = RATIO;
- else {
- if(1 == sscanf(arg, "%lf", &delta)) {
- if(delta + ratio < .1 || delta + ratio > 1.9)
- return;
- ratio += delta;
- }
- }
- lt->arrange();
+void
+incvratio(const char *arg) {
+ incratio(arg, &vratio, VRATIO);
}
void