hi Kelly, 

I had the same problem when I started using awesome and ended up hacking this 
layout you find attached.
It works, but I guarantee for nothing - haven't even looked at the code for 
ages...

Maybe you find it usefull and want to improve the code...

hpa
---------------------------------------------------------------------------
-- author Hans Philipp Annen <[email protected]>
-- @author Donald Ephraim Curtis &lt;[email protected]&gt;
-- @author Julien Danjou &lt;[email protected]&gt;
-- @copyright 2009 Donald Ephraim Curtis
-- @copyright 2008 Julien Danjou
-- @release @AWESOME_VERSION@
---------------------------------------------------------------------------

-- Grab environment we need
local ipairs = ipairs
local math = math
local tag = require("awful.tag")

--- Tiled layouts module for awful
module("hplayout.split")

--layouts_name[hplayout.split] = "split"
--layouts_name[hplayout.split.left] = "splitleft"
--layouts_name[hplayout.splitright] = "splitright"
--layouts_name[hplayout.splittop] = "splittop"
--layouts_name[hplayout.splitbottom] = "splitbottom"

local function calcSize(x, y, width, height, num, den, geom)
        local g = {}
        g[x] = geom[x]
        g[y] = geom[y]
        g[width] = geom[width]
        g[height] = (g[width]*num)/den
        if (g[height] > geom[height]) then
                g[height] = geom[height]
                g[width] = (g[height]*den)/num
        end     
        
        -- adjust position
        g[y] = geom[y] + (geom[height]-g[height])/2
        g[x] = geom[x] + (geom[width]-g[width])/2
        return g
end

local function split(param, orientation)
        local t = tag.selected(param.screen)
    orientation = orientation or "top"

    -- this handles are different orientations
    local height = "height"
    local width = "width"
    local x = "x"
    local y = "y"
    if orientation == "top" or orientation == "bottom" then
        height = "width"
        width = "height"
        x = "y"
        y = "x"
    end

--    local t = tag.selected(screen)
    local cls = param.clients

    local mwfact = tag.getmwfact(t)
    local wa = param.workarea
--    local ncol = tag.getncol(t)

--    local data = tag.getproperty(t,"windowfact")

--    if not data then
--        data = {}
--        tag.setproperty(t,"windowfact", data)
--    end
        
        -- two areas
        local masterarea = {}
        local otherarea = {}
        
        otherarea[x] =  wa[x]
        otherarea[y] =  wa[y]
        otherarea[height] = wa[height]
        otherarea[width] = wa[width]*(1-mwfact)
        masterarea[x] =  wa[x]
        masterarea[y] =  wa[y]
        masterarea[height] = wa[height]
        if #cls == 1 then 
                masterarea[width] = wa[width]
        else
                masterarea[width] = wa[width]*mwfact
                if orientation == "top" or orientation == "left" then
                        masterarea[x] = wa[x]+otherarea[width]
                else
                        otherarea[x] = wa[x]+masterarea[width]
                end
        end


        for c = 1,#cls do
                -- respect aspect ratio hints
                local size_hints = cls[c].size_hints
                local geom = {}
                if c == 1 then 
                        geom[x] = masterarea[x]
                        geom[y] = masterarea[y]
                        geom[width] = masterarea[width]
                        geom[height] = masterarea[height]
                else
                        geom[x] = otherarea[x]
                        geom[y] = otherarea[y]
                        geom[width] = otherarea[width]
                        geom[height] = otherarea[height]
                end
                local minaspectnum = size_hints["min_aspect_num"]
                local maxaspectnum = size_hints["max_aspect_num"]
                local minaspectden = size_hints["min_aspect_den"]
                local maxaspectden = size_hints["max_aspect_den"]
                if minaspectnum and minaspectnum == maxaspectnum and 
maxaspectden == maxaspectden then
                        if orientation == "top" or orientation == "bottom" then
                                geom = 
calcSize(x,y,width,height,minaspectnum,minaspectden,geom)
                        else
                                geom = 
calcSize(x,y,width,height,minaspectden,minaspectnum,geom)
                        end
                end
                cls[c]:geometry(geom)
        end
end

--- The main tile algo, on left.
-- @param screen The screen number to tile.
left = {}
left.name = "splitleft"
function left.arrange(p)
    return split(p, "left")
end

--- The main tile algo, on bottom.
-- @param screen The screen number to tile.
bottom = {}
bottom.name = "splitbottom"
function bottom.arrange(p)
    return split(p, "bottom")
end

--- The main tile algo, on top.
-- @param screen The screen number to tile.
top = {}
top.name = "splittop"
function top.arrange(p)
    return split(p, "top")
end

--- The main tile algo, on top.
-- @param screen The screen number to tile.
right = {}
right.name = "splitright"
function right.arrange(p)
    return split(p, "right")
end

--local layouts_name =
--{
--    [hplayout.split]            = "split",
--    [hplayout.split.left]       = "splitleft",
--    [hplayout.split.right]      = "splitright",
--   [hplayout.split.bottom]     = "splitbottom",
--    [hplayout.split.top]        = "splittop",
--}

arrange = top.arrange
name = top.name

Attachment: pgpUHR6zejttM.pgp
Description: PGP signature

Reply via email to