This is incredibly useful information, thank you.

There's one detail I haven't quite nailed down yet.  How do tags play into
this?  Does the "clients" entry of the parameter to arrange(p) only contain
clients which are supposed to be shown (according to their tags and which
tags are currently selected)?  Also, do I have to handle minimized/maximized
screens myself in the layout, or does awesome take care of those elsewhere?

Thanks again.

-- Ethan

On Mon, Aug 8, 2011 at 1:47 PM, Uli Schlachter <psyc...@znc.in> wrote:

> On 07.08.2011 23:18, Ethan Levine wrote:
> > I'm trying to find information regarding writing my own custom layout for
> > awesome.  Instead of the ones that come with it, I want one where my
> screen
> > is split into columns, and if you assign multiple windows to the same
> > column, they'll just stack.
> >
> > I've tried reading through the source code for the built-in layouts, but
> > it's hard to tell what's going on (a combination of few comments and Lua
> > being dynamically typed).  The API documentation is also quite scant in
> this
> > regard.
> >
> > Are there any resources available to help me write my own custom layout
> for
> > awesome?  Do you have any hints as to where to start?  I'd also be
> grateful
> > for any nice examples of others' custom layouts, so I can see how they
> work
> > (as far as I can tell from reading the source code, I need to call
> > client:geometry(new_geometry), but I'm not sure if I need to do anything
> > else, or exactly what the parameters to "arrange" are).
>
> A layout is a table with two entries. "name" is a string for the layout's
> name
> and "arrange" is a function which is called when there are clients which
> have to
> be, well, arranged.
>
> arrange gets a table as its argument. This table has the following entries:
>
> - screen: The screen which is being arranged, e.g. 1
> - clients: A table containing all clients which should be arranged. This
> means
> that e.g. floating clients aren't in here. Basically, this are all clients
> that
> you work with.
> - geometry: The geometry of the screen. Basically, this is the size of the
> monitor.
> - workarea: Basically, "the available space". This is the geometry minus
> stuff
> like the wibox or space which is used by clients which are docked to the
> edge of
> the screen.
>
> With this info you know are supposed to place the clients. You place them
> by
> calling c:geometry({ x = 1, y = 2, width = 3, height = 4}). A simple
> example
> would be the "max" layout (here comes a slightly simplified version):
>
> function arrange(p)
>  local area = p.workarea
>  for k, v in ipairs(p.clients) do
>    local g = {
>          x = area.x,
>          y = area.y,
>          width = area.width - c.border_width * 2,
>          height = area.height - c.border_width * 2,
>    }
>    c:geometry(g)
>  end
> end
>
> This function just goes through all clients and resized each one to be as
> large
> as the workarea. That means they will cover all the available area.
>
> Since X11 doesn't include the borders in the client size, the code here has
> to
> substract the width of the border on each size. Basically, the above code
> ensures that the complete client including its border is visible. Here
> comes
> some ugly ASCII:
>
>  (x,y)--------------------
>    |  _________________  |
>    |  |<- ^ width   ->|  |
>    |  |   |           |  |
>    |  |  height       |  |
>    |  |   |           |  |
>    |  |   v           |  |
>    |  -----------------  |
>    -----------------------
>
> (x,y) is the point where the client is placed at. The client's drawing
> space
> starts at (x+border_width, y+border_width). The rest should be clear.
>
>
> I hope this helped,
> Uli
> --
> The Angels have the phone box!
>
> --
> To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.
>

Reply via email to