Re: [wmii] Customized layouts?

From: Juanval <juanval_AT_gmail.com>
Date: Fri, 2 Dec 2005 01:02:20 +0100

WOW! That's EXACTLY what I meant!
Thank you VERY much :DDD

Now I will defnitely use WMII as my WM of choice in my laptop.

And... will this layout be part of the standard "WMII Layout Set"? I
for one think this is a very useful layout, although I would
understand if you didn't want to add lots and lots of layouts, but
just the necessary ones. So, what do you say?

bye!
P.S: And thanks again, Sam for that layout :-)

On 12/1/05, Sam Stone <samstone_AT_gmx.de> wrote:
> > Could I define a custom layout such as the tiled layout but
> > rotated 90 degrees clockwise? (big frame up, and lots of small frames
> > below)
>
> Create a File called "layout_master.c" (yes I now, stupid name)
> in /wmii/cmd/wm, put in the following code, and recompile wmii:
>
>
>
> /*
> * (C)opyright MMIV-MMV Anselm R. Garbe <garbeam at gmail dot com>
> * See LICENSE file for license details.
> *
> * (modified)
> */
>
> #include <stdlib.h>
> #include <string.h>
>
> #include "wmiiwm.h"
> #include "layout.h"
>
> #include <cext.h>
>
> /* master layout definition */
> static void arrange_master(Page * p);
> static void init_master(Page * p);
> static void deinit_master(Page * p);
> static void manage_master(Frame * f);
> static void unmanage_master(Frame * f);
> static void resize_master(Frame * f, XRectangle * new, XPoint * pt);
> static Frame *select_master(Frame * f, char *what);
>
> static Layout master =
> {"master", init_master, deinit_master, arrange_master, manage_master,
> unmanage_master, resize_master, select_master
> };
>
> void
> init_layout_master()
> {
> layouts =
> (Layout **) attach_item_end((void **) layouts, &master,
> sizeof(Layout *));
> }
>
> static void
> arrange_master(Page * p)
> {
> int tw, th, i, size = 0;
>
> if (!p->managed)
> return;
>
> /* determing num of frame and size of page */
> size = count_items((void **) p->managed);
>
> if (size > 1) {
> tw = p->managed_rect.width / (size -1);
> th = (p->managed_rect.height * *((int *) p->aux)) / 100;
> // tw = (p->managed_rect.width * *((int *) p->aux)) / 100;
> // th = p->managed_rect.height / (size - 1);
> } else {
> tw = p->managed_rect.width;
> th = p->managed_rect.height;
> }
>
> /* master tile */
> p->managed[0]->managed_rect.x = p->managed_rect.x;
> p->managed[0]->managed_rect.y = p->managed_rect.y;
> p->managed[0]->managed_rect.width = p->managed_rect.width;
> p->managed[0]->managed_rect.height = th;
> resize_frame(p->managed[0], &p->managed[0]->managed_rect, 0, 1);
>
> if (size == 1)
> return;
> for (i = 1; i < size; i++) {
> p->managed[i]->managed_rect.x = p->managed_rect.x + (i -
> 1) *
> tw;
> p->managed[i]->managed_rect.y = p->managed_rect.y + th;
> p->managed[i]->managed_rect.width = tw;
> p->managed[i]->managed_rect.height =
> p->managed_rect.height -
> th;
> resize_frame(p->managed[i], &p->managed[i]->managed_rect,
> 0,
> 1);
> }
> }
>
> static void
> init_master(Page * p)
> {
> p->aux = emalloc(sizeof(int));
> *((int *) p->aux) =
> _strtonum(core_files[CORE_PAGE_TILE_WIDTH]->content, 5,
> 95);
> }
>
> static void
> deinit_master(Page * p)
> {
> p->aux = 0;
> }
>
> static void
> manage_master(Frame * f)
> {
> Page *p = f->page;
> if (!p)
> return;
> arrange_master(p);
> }
>
> static void
> unmanage_master(Frame * f)
> {
> manage_master(f);
> }
>
> static void
> drop_resize(Frame * f, XRectangle * new)
> {
> Page *p = f->page;
> int num = 0;
> int rearrange = 0;
>
> if (!p)
> return;
> /* determing num of frame and size of page */
> num = index_item((void **) p->managed, f);
>
> if (!num) { /* master tile */
> if ((f->managed_rect.x == new->x)
> && (f->managed_rect.height != new->height)) {
> f->managed_rect = *new;
> rearrange = 1;
> }
> } else if (f->managed_rect.x != new->x) {
> int diff = f->managed_rect.height - new->height;
> p->managed[0]->managed_rect.height += diff;
> rearrange = 1;
> }
> if (rearrange) {
> int th =
> (p->managed[0]->managed_rect.height * 100) /
> p->managed_rect.height;
> if (th > 95)
> th = 95;
> else if (th < 5)
> th = 5;
> *((int *) p->aux) = th;
> arrange_master(p);
> }
> }
>
> static void
> resize_master(Frame * f, XRectangle * new, XPoint * pt)
> {
> if ((f->managed_rect.width == new->width)
> && (f->managed_rect.height == new->height))
> drop_move(f, new, pt);
> else
> drop_resize(f, new);
> }
>
> static Frame *
> select_master(Frame * f, char *what)
> {
> Page *p = f->page;
> int idx;
> if (!strncmp(what, "prev", 5)) {
> idx = index_prev_item((void **) p->managed, f);
> if (idx >= 0)
> return p->managed[idx];
> } else if (!strncmp(what, "next", 5)) {
> idx = index_next_item((void **) p->managed, f);
> if (idx >= 0)
> return p->managed[idx];
> } else if (!strncmp(what, "zoomed", 7)) {
> idx = index_item((void **) p->managed, f);
> if (idx == 0 && p->managed[1])
> idx = 1;
> if (idx > 0)
> swap((void **) &p->managed[0], (void **)
> &p->managed[idx]);
> p->managed_stack = (Frame **)
> attach_item_begin(detach_item
> ((void **) p->managed_stack,
> p->managed[0],
> sizeof(Frame *)), p->managed[0],
> sizeof(Frame *));
> arrange_master(p);
> return p->managed_stack[0];
> }
> return 0;
> }
>
> --
> 10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
> +++ GMX - die erste Adresse für Mail, Message, More +++
>
> _______________________________________________
> wmii_AT_wmii.de mailing list
> http://wmii.de/cgi-bin/mailman/listinfo/wmii
>
Received on Fri Dec 02 2005 - 01:06:57 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:59:31 UTC