Hi Rena,

Joined is a draft patch to add a "corner" layout. Of course, you have to
add it in your rc.lua file!
You can also find it on my github account :
https://github.com/AlexisBRENON/awesome/tree/feature/corner_layout
I compiled it without any problem and it works quite well. I've got some
weird behaviour, but I tried it with small screen resolution, with terminal
which honour size hints (round height and width to match a full number of
columns and rows), and so, sometimes there is gap between windows.
I hope that you can understand my new file : lib/awful/layout/suit/
corner.lua.in, and that you will be able to change it to meet the best as
it can you need.

Kind regards,
Alexis

Le lun. 25 mai 2015 à 10:20, Alexis BRENON <[email protected]> a
écrit :

> Hi Rena,
>
> I don't use spiral or dwindle layout, so I don't exactly know how they
> behave. Nevertheless, I think that they are the nearest to what you try to
> achieve.
>
> I never implement a new layout, so I can't really help you for the moment.
> I suggest you to copy one of spiral or dwindle and try to modify it. I will
> try this also. I will tell you if I manage anything.
>
> Kind regards,
> Alexis.
>
> Le ven. 22 mai 2015 à 23:40, Rena <[email protected]> a écrit :
>
>> On Fri, May 22, 2015 at 3:16 AM, Alexis BRENON <[email protected]>
>> wrote:
>> > Hi Rena,
>> >
>> > It seems quite similar to spiral or zig-zag layouts, doesn't ? Dis you
>> try
>> > them ? Maybe you can create a new layout based on these which better
>> fits
>> > your needs.
>> >
>> > Kind regards,
>> > Alexis
>> >
>> > Le ven. 22 mai 2015 à 02:49, Rena <[email protected]> a écrit :
>> >>
>> >> How can I achieve a layout like this? http://i.imgur.com/lNF0fpw.png
>> >>
>> >> --
>> >> Sent from my Game Boy.
>> >>
>> >> --
>> >> To unsubscribe, send mail to [email protected].
>>
>> Those layouts appear to divide the screen area repeatedly in half?
>> It's not quite what I'm after. Perhaps if I could adjust them a bit.
>> The spiral, dwindle, and fair layouts don't seem to let me resize any
>> windows and ignore the nmaster/ncols settings; not sure if that's a
>> bug?
>>
>> I think my first image wasn't clear, maybe an animation will help:
>> http://i.imgur.com/JVnsfkX.gifv
>>
>> Basically with most layouts there's one row or column for "master"
>> windows and N for "non-master" windows (where N is adjustable). What
>> I'm looking for is the non-master windows to be in both rows *and*
>> columns, with the master window(s) in a corner.
>>
>> I might have a go at implementing it myself, but I'm not really sure
>> where to begin there.
>>
>> --
>> Sent from my Game Boy.
>>
>
diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in
index 875e851..c2f82cd 100755
--- a/lib/awful/layout/init.lua.in
+++ b/lib/awful/layout/init.lua.in
@@ -31,6 +31,7 @@ layout.suit = require("awful.layout.suit")
 -- The default list of layouts
 layout.layouts = {
     layout.suit.floating,
+    layout.suit.corner,
     layout.suit.tile,
     layout.suit.tile.left,
     layout.suit.tile.bottom,
diff --git a/lib/awful/layout/suit/corner.lua.in b/lib/awful/layout/suit/corner.lua.in
new file mode 100644
index 0000000..7c8757d
--- /dev/null
+++ b/lib/awful/layout/suit/corner.lua.in
@@ -0,0 +1,90 @@
+---------------------------------------------------------------------------
+-- @author Uli Schlachter &lt;[email protected]&gt;
+-- @copyright 2009 Uli Schlachter
+-- @copyright 2008 Julien Danjou
+-- @release @AWESOME_VERSION@
+---------------------------------------------------------------------------
+
+-- Grab environment we need
+local ipairs = ipairs
+local math = math
+
+-- awful.layout.suit.corner
+local corner = {}
+
+local function do_corner(p)
+    local wa = p.workarea
+    local cls = p.clients
+
+    local master_width = 1
+    local master_height = 1
+    if #cls > 1 then
+        master_width = 0.75
+        if #cls > 2 then
+            master_height = 0.75
+        end
+    end
+    local column = {}
+    local row = {}
+
+    column.x = wa.x + (master_width * wa.width)
+    column.width = wa.width - (master_width * wa.width)
+    column.height = wa.height
+    column.number_win = math.ceil((#cls - 1)/2)
+    column.win_height = column.height/column.number_win
+    column.win_idx = 0
+
+    row.y = wa.y + (master_height * wa.height)
+    row.width = wa.width - column.width
+    row.height = wa.height - (master_height * wa.height)
+    row.number_win = (#cls - 1) - column.number_win
+    row.win_width = row.width/row.number_win
+    row.win_idx = 0
+
+    for i, c in ipairs(cls) do
+        local g = nil
+        -- Handle master window
+        if i == 1 then
+            g = {
+                x = wa.x,
+                y = wa.y,
+                width = (master_width * wa.width) - (2 * c.border_width),
+                height = (master_height * wa.height) - (2 * c.border_width)
+            }
+        -- handle windows in column
+        elseif i % 2 == 0 then
+            g = {
+                x = column.x,
+                y = wa.y + (column.win_idx * column.win_height),
+                width = column.width - (2 * c.border_width),
+                height = column.win_height - (2 * c.border_width)
+            }
+            column.win_idx = column.win_idx + 1
+        else
+            g = {
+                x = wa.x + (row.win_idx * row.win_width),
+                y = row.y,
+                width = row.win_width - (2 * c.border_width),
+                height = row.height - (2 * c.border_width)
+            }
+            row.win_idx = row.win_idx + 1
+        end
+        print("geometry = {")
+        for k, v in pairs(g) do
+            print(k .. " : " .. v)
+        end
+        print("}\n")
+        c:geometry(g)
+    end
+    print("\n")
+end
+
+--- Corner layout
+corner.name = "corner"
+function corner.arrange(p)
+    return do_corner(p)
+end
+
+return corner
+
+-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
diff --git a/lib/awful/layout/suit/init.lua.in b/lib/awful/layout/suit/init.lua.in
index 3c35408..a29b2c0 100644
--- a/lib/awful/layout/suit/init.lua.in
+++ b/lib/awful/layout/suit/init.lua.in
@@ -8,6 +8,7 @@
 
 return
 {
+    corner = require("awful.layout.suit.corner");
     max = require("awful.layout.suit.max");
     tile = require("awful.layout.suit.tile");
     fair = require("awful.layout.suit.fair");
diff --git a/themes/default/layouts/corner.png b/themes/default/layouts/corner.png
new file mode 100644
index 0000000..bebe15a
Binary files /dev/null and b/themes/default/layouts/corner.png differ
diff --git a/themes/default/layouts/cornerw.png b/themes/default/layouts/cornerw.png
new file mode 100644
index 0000000..8b4d640
Binary files /dev/null and b/themes/default/layouts/cornerw.png differ
diff --git a/themes/default/theme.lua.in b/themes/default/theme.lua.in
index 0fc683c..29a0dbc 100644
--- a/themes/default/theme.lua.in
+++ b/themes/default/theme.lua.in
@@ -88,6 +88,7 @@ theme.layout_tile = "@AWESOME_THEMES_PATH@/default/layouts/tilew.png"
 theme.layout_tiletop = "@AWESOME_THEMES_PATH@/default/layouts/tiletopw.png"
 theme.layout_spiral  = "@AWESOME_THEMES_PATH@/default/layouts/spiralw.png"
 theme.layout_dwindle = "@AWESOME_THEMES_PATH@/default/layouts/dwindlew.png"
+theme.layout_corner = "@AWESOME_THEMES_PATH@/default/layouts/cornerw.png"
 
 theme.awesome_icon = "@AWESOME_ICON_PATH@/awesome16.png"
 

Reply via email to