diff --git a/cmd/wm/layout_column.c b/cmd/wm/layout_column.c index bd3367c0..eaa6a05f 100644 --- a/cmd/wm/layout_column.c +++ b/cmd/wm/layout_column.c @@ -50,6 +50,7 @@ static Client *sel_column(Layout *l); static Action *actions_column(Layout *l); static void select_frame(void *obj, char *arg); +static void max_frame(void *obj, char *arg); static void swap_frame(void *obj, char *arg); static void new_column(void *obj, char *arg); @@ -57,6 +58,7 @@ static Action lcol_acttbl[] = { {"select", select_frame}, {"swap", swap_frame}, {"new", new_column}, + {"max", max_frame}, {0, 0} }; @@ -455,6 +457,37 @@ actions_column(Layout *l) return lcol_acttbl; } +static void +max_frame(void *obj, char *arg) +{ + Layout *l = obj; + Acme *acme = l->aux; + Column *c = acme->sel; + Cell *cell; + Frame *f; + + if(!c) + return; + + cell = c->sel; + if(!cell) + return; + + f = cell->frame; + if(f->maximized) { + f->rect = f->old; + resize_frame(f, &f->old, nil); + f->maximized = False; + } + else { + f->old = f->rect; + f->rect = c->rect; + XRaiseWindow(dpy, f->win); + resize_frame(f, &c->rect, nil); + f->maximized = True; + } +} + static void select_frame(void *obj, char *arg) { diff --git a/cmd/wm/layout_float.c b/cmd/wm/layout_float.c index 5db4eefe..85cf5c86 100644 --- a/cmd/wm/layout_float.c +++ b/cmd/wm/layout_float.c @@ -22,9 +22,11 @@ static Client *sel_float(Layout *l); static Action *actions_float(Layout *l); static void select_frame(void *obj, char *arg); +static void max_frame(void *obj, char *arg); Action lfloat_acttbl[] = { {"select", select_frame}, + {"max", max_frame}, {0, 0} }; @@ -204,6 +206,26 @@ frames_float(Layout *l) return fl->frames; } +static void +max_frame(void *obj, char *arg) +{ + Layout *l = obj; + Float *fl = l->aux; + Frame *f = fl->sel; + + if(!f) + return; + if(f->maximized) { + resize_frame(f, &f->old, nil); + f->maximized = False; + } + else { + f->old = f->rect; + resize_frame(f, &rect, nil); + f->maximized = True; + } +} + static void select_frame(void *obj, char *arg) { diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h index 487320b3..001860a8 100644 --- a/cmd/wm/wm.h +++ b/cmd/wm/wm.h @@ -138,6 +138,8 @@ struct Frame { Client *sel; Client *clients; size_t nclients; + Bool maximized; + XRectangle old; GC gc; XRectangle rect; Cursor cursor; diff --git a/rc/wmiirc b/rc/wmiirc index 533651e5..3b080119 100755 --- a/rc/wmiirc +++ b/rc/wmiirc @@ -169,6 +169,7 @@ kbind normal $MODKEY-a 'wmiir write /wm/ctl attach' kbind normal $MODKEY-S-a 'wmiir write /wm/ctl detclients' kbind normal $MODKEY-S-c 'wmiir write /wm/sel/layoutname column' kbind normal $MODKEY-n 'wmiir write /wm/sel/layout/sel/ctl new' +kbind normal $MODKEY-m 'wmiir write /wm/sel/layout/sel/ctl max' kbind normal $MODKEY-S-f 'wmiir write /wm/sel/layoutname float' kbind normal $MODKEY-Return 'wmiir write /wm/sel/layout/sel/ctl ''swap west''' kbind normal $MODKEY-S-Return 'wmiir write /wm/sel/layout/sel/ctl ''swap east'''