setlayout and setgeom are now togglable again
parent
a6a216f28c
commit
20cd336087
20
config.def.h
20
config.def.h
|
@ -22,15 +22,11 @@ Rule rules[] = {
|
||||||
/* func name bx by bw wx wy ww wh mx my mw mh tx ty tw th mox moy mow moh */
|
/* func name bx by bw wx wy ww wh mx my mw mh tx ty tw th mox moy mow moh */
|
||||||
DEFGEOM(single, 0, 0, sw, 0, bh, sw, sh-bh, wx, wy, 0.55*sw, wh, mx+mw, wy, ww-mw, wh, wx, wy, ww, wh)
|
DEFGEOM(single, 0, 0, sw, 0, bh, sw, sh-bh, wx, wy, 0.55*sw, wh, mx+mw, wy, ww-mw, wh, wx, wy, ww, wh)
|
||||||
DEFGEOM(dual, 0, 0,1280, 0, bh, ww, wh-bh, wx, wy, 1280,800-bh, 1280, 0, ww-mw, sh, mx, my, mw, mh)
|
DEFGEOM(dual, 0, 0,1280, 0, bh, ww, wh-bh, wx, wy, 1280,800-bh, 1280, 0, ww-mw, sh, mx, my, mw, mh)
|
||||||
/* DEFGEOM(growmaster, bx, by, bw, wx, wy, ww, wh, mx, my, mw+20, mh, mx+mw, ty, tw-20, th, mox, moy, mow, moh) */
|
|
||||||
/* DEFGEOM(shrinkmaster, bx, by, bw, wx, wy, ww, wh, mx, my, mw-20, mh, mx+mw, ty, tw+20, th, mox, moy, mow, moh) */
|
|
||||||
|
|
||||||
Geom geoms[] = {
|
Geom geoms[] = {
|
||||||
/* symbol function */
|
/* symbol function */
|
||||||
{ "<>", single }, /* first entry is default */
|
{ "[]", single }, /* first entry is default */
|
||||||
{ ")(", dual },
|
{ "[][]", dual },
|
||||||
/* { "+|", growmaster },*/
|
|
||||||
/* { "|-", shrinkmaster },*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
|
@ -49,22 +45,18 @@ Layout layouts[] = {
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod1Mask
|
||||||
Key keys[] = {
|
Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_a, setgeom, ")(" },
|
|
||||||
{ MODKEY, XK_d, setgeom, "<>" },
|
|
||||||
{ MODKEY, XK_p, spawn,
|
{ MODKEY, XK_p, spawn,
|
||||||
"exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" },
|
"exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" },
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" },
|
{ MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" },
|
||||||
{ MODKEY, XK_j, focusnext, NULL },
|
{ MODKEY, XK_j, focusnext, NULL },
|
||||||
{ MODKEY, XK_k, focusprev, NULL },
|
{ MODKEY, XK_k, focusprev, NULL },
|
||||||
{ MODKEY, XK_r, reapply, NULL },
|
{ MODKEY, XK_r, reapply, NULL },
|
||||||
{ MODKEY, XK_Return, zoom, NULL },
|
{ MODKEY, XK_Return, zoom, NULL },
|
||||||
{ MODKEY, XK_Tab, viewprevtag, NULL },
|
{ MODKEY, XK_Tab, viewprevtag, NULL },
|
||||||
{ MODKEY, XK_m, setlayout, "[M]" },
|
|
||||||
{ MODKEY, XK_f, setlayout, "><>" },
|
|
||||||
{ MODKEY, XK_v, setlayout, "[]=" },
|
|
||||||
{ MODKEY, XK_h, setlayout, "[]|" },
|
|
||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, NULL },
|
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, NULL },
|
{ MODKEY|ShiftMask, XK_c, killclient, NULL },
|
||||||
|
{ MODKEY, XK_space, setlayout, NULL },
|
||||||
|
{ MODKEY|ShiftMask, XK_space, togglefloating, NULL },
|
||||||
|
{ MODKEY|ControlMask, XK_space, setgeom, NULL },
|
||||||
{ MODKEY, XK_0, view, NULL },
|
{ MODKEY, XK_0, view, NULL },
|
||||||
{ MODKEY, XK_1, view, tags[0] },
|
{ MODKEY, XK_1, view, tags[0] },
|
||||||
{ MODKEY, XK_2, view, tags[1] },
|
{ MODKEY, XK_2, view, tags[1] },
|
||||||
|
|
14
dwm.1
14
dwm.1
|
@ -57,17 +57,11 @@ click on a tag label adds/removes that tag to/from the focused window.
|
||||||
Start
|
Start
|
||||||
.BR xterm.
|
.BR xterm.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-f
|
.B Mod1\-space
|
||||||
Applies floating layout.
|
Toggles between layouts.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-m
|
.B Mod1\-Control\-space
|
||||||
Applies monocle layout.
|
Toggles between geometries.
|
||||||
.TP
|
|
||||||
.B Mod1\-v
|
|
||||||
Applies vertical tiled layout.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-h
|
|
||||||
Applies horizontal tiled layout.
|
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-j
|
.B Mod1\-j
|
||||||
Focus next window.
|
Focus next window.
|
||||||
|
|
46
dwm.c
46
dwm.c
|
@ -322,6 +322,10 @@ buttonpress(XEvent *e) {
|
||||||
XButtonPressedEvent *ev = &e->xbutton;
|
XButtonPressedEvent *ev = &e->xbutton;
|
||||||
|
|
||||||
if(ev->window == barwin) {
|
if(ev->window == barwin) {
|
||||||
|
if((ev->x < bgw) && ev->button == Button1) {
|
||||||
|
setgeom(NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
x = bgw;
|
x = bgw;
|
||||||
for(i = 0; i < LENGTH(tags); i++) {
|
for(i = 0; i < LENGTH(tags); i++) {
|
||||||
x += textw(tags[i]);
|
x += textw(tags[i]);
|
||||||
|
@ -341,6 +345,8 @@ buttonpress(XEvent *e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if((ev->x < x + blw) && ev->button == Button1)
|
||||||
|
setlayout(NULL);
|
||||||
}
|
}
|
||||||
else if((c = getclient(ev->window))) {
|
else if((c = getclient(ev->window))) {
|
||||||
focus(c);
|
focus(c);
|
||||||
|
@ -426,7 +432,7 @@ configurenotify(XEvent *e) {
|
||||||
if(ev->window == root && (ev->width != sw || ev->height != sh)) {
|
if(ev->window == root && (ev->width != sw || ev->height != sh)) {
|
||||||
sw = ev->width;
|
sw = ev->width;
|
||||||
sh = ev->height;
|
sh = ev->height;
|
||||||
setgeom(NULL);
|
setgeom(geom->symbol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1417,12 +1423,18 @@ void
|
||||||
setgeom(const char *arg) {
|
setgeom(const char *arg) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for(i = 0; arg && i < LENGTH(geoms); i++)
|
if(!arg) {
|
||||||
if(!strcmp(geoms[i].symbol, arg))
|
if(++geom == &geoms[LENGTH(geoms)])
|
||||||
break;
|
geom = &geoms[0];
|
||||||
if(i == LENGTH(geoms))
|
}
|
||||||
return;
|
else {
|
||||||
geom = &geoms[i];
|
for(i = 0; i < LENGTH(geoms); i++)
|
||||||
|
if(!strcmp(geoms[i].symbol, arg))
|
||||||
|
break;
|
||||||
|
if(i == LENGTH(geoms))
|
||||||
|
return;
|
||||||
|
geom = &geoms[i];
|
||||||
|
}
|
||||||
geom->apply();
|
geom->apply();
|
||||||
updatebarpos();
|
updatebarpos();
|
||||||
arrange();
|
arrange();
|
||||||
|
@ -1430,20 +1442,18 @@ setgeom(const char *arg) {
|
||||||
|
|
||||||
void
|
void
|
||||||
setlayout(const char *arg) {
|
setlayout(const char *arg) {
|
||||||
static Layout *revert = 0;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if(!arg)
|
if(!arg) {
|
||||||
return;
|
if(++lt == &layouts[LENGTH(layouts)])
|
||||||
for(i = 0; i < LENGTH(layouts); i++)
|
lt = &layouts[0];
|
||||||
if(!strcmp(arg, layouts[i].symbol))
|
}
|
||||||
break;
|
|
||||||
if(i == LENGTH(layouts))
|
|
||||||
return;
|
|
||||||
if(revert && &layouts[i] == lt)
|
|
||||||
lt = revert;
|
|
||||||
else {
|
else {
|
||||||
revert = lt;
|
for(i = 0; i < LENGTH(layouts); i++)
|
||||||
|
if(!strcmp(arg, layouts[i].symbol))
|
||||||
|
break;
|
||||||
|
if(i == LENGTH(layouts))
|
||||||
|
return;
|
||||||
lt = &layouts[i];
|
lt = &layouts[i];
|
||||||
}
|
}
|
||||||
if(sel)
|
if(sel)
|
||||||
|
|
Loading…
Reference in New Issue