-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Andrei Thorp wrote: > Hello, > > "clockwork" on IRC (with really poor English) has requested that I ask > whether someone would be interesting in writing spiral in lua for him. > He seemed to really like it. > > Anyway, perhaps someone wants to do this.
Hi, attached is the patch, have fun. ;) Could someone create some layout icons for this? The ones from awesome 2 are... improvable. Apropos icons: Could we do something to clean up / unify themes/default/layouts/ and themes/sky/layouts/? Or do we really need so many different icons? That kind of makes it a little more difficult to add "new" layouts... Uli - -- "Do you know that books smell like nutmeg or some spice from a foreign land?" -- Faber in Fahrenheit 451 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQEcBAEBCAAGBQJKWiz9AAoJECLkKOvLj8sG2E8H/A1/L8iTQhB698GJT8l9s0jK wSGXNrXb+fVBybqZ2/mb4lT+rhUTtDiV3jniuwWtdMLtrObsmRTgnK6JOOx+7aRQ 5htbvi35Js22M26vJzAY5G6/8k7IVf/vZ6IY2M74a7s7+ufkKyYNgy3DAJDt/BOV gynDBYDFRnrNFYAbMVBcs0PRGRPuin8vXs6vvDnVEcIh5NK6c+TTSY5dw9PfUvL6 DKiyq+67GURDRpnSYhB/uyMtb/qb/Qm1VWiy4H2RMpx/gr5OrZPPkyrObTqdUoT5 1OJEzMPGrGpLVj8ttm9SD3tA2C+mPWR+bxWv1YRGKlZFToG+bLDkmFAPnLQHBek= =sjBN -----END PGP SIGNATURE-----
>From 7c3399a71eae23077b8bbb6356769b01f1455c5b Mon Sep 17 00:00:00 2001 From: Uli Schlachter <psyc...@znc.in> Date: Sun, 12 Jul 2009 20:27:41 +0200 Subject: [PATCH] Add fibanocci layouts ported from the C version This is based on the C code from commit b9320be372be84f8b9140fce62b77c7462490. Signed-off-by: Uli Schlachter <psyc...@znc.in> --- awesomerc.lua.in | 2 + lib/awful/layout/suit/init.lua.in | 1 + lib/awful/layout/suit/spiral.lua.in | 79 +++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 0 deletions(-) create mode 100644 lib/awful/layout/suit/spiral.lua.in diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 4783c2f..53ae46f 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -36,6 +36,8 @@ layouts = awful.layout.suit.tile.top, awful.layout.suit.fair, awful.layout.suit.fair.horizontal, + awful.layout.suit.spiral, + awful.layout.suit.spiral.dwindle, awful.layout.suit.max, awful.layout.suit.max.fullscreen, awful.layout.suit.magnifier, diff --git a/lib/awful/layout/suit/init.lua.in b/lib/awful/layout/suit/init.lua.in index ae83edf..d5d4e3f 100644 --- a/lib/awful/layout/suit/init.lua.in +++ b/lib/awful/layout/suit/init.lua.in @@ -3,6 +3,7 @@ require("awful.layout.suit.tile") require("awful.layout.suit.fair") require("awful.layout.suit.floating") require("awful.layout.suit.magnifier") +require("awful.layout.suit.spiral") --- Suits for awful module("awful.layout.suit") diff --git a/lib/awful/layout/suit/spiral.lua.in b/lib/awful/layout/suit/spiral.lua.in new file mode 100644 index 0000000..0c00644 --- /dev/null +++ b/lib/awful/layout/suit/spiral.lua.in @@ -0,0 +1,79 @@ +--------------------------------------------------------------------------- +-- @author Uli Schlachter <psyc...@znc.in> +-- @copyright 2009 Uli Schlachter +-- @copyright 2008 Julien Danjou +-- @release @AWESOME_VERSION@ +--------------------------------------------------------------------------- + +-- Grab environment we need +local ipairs = ipairs + +module("awful.layout.suit.spiral") + +local function spiral(p, dwindle) + local wa = p.workarea + local cls = p.clients + + local i = 0 + local n = #cls + local nx = wa.x + local ny = wa.y + local nw = wa.width + local nh = wa.height + + for k, c in ipairs(cls) do + if (i % 2 == 1 and nh / 2 > 2 * c.border_width) + or (i % 2 == 0 and nw / 2 > 2 * c.border_width) then + if i < n - 1 then + if i % 2 == 1 then + nh = nh / 2 + else + nw = nw / 2 + end + if i % 4 == 2 and not dwindle then + nx = nx + nw + elseif i % 4 == 3 and not dwindle then + ny = ny + nh + end + end + if i % 4 == 0 then + if dwindle then + ny = ny + nh + else + ny = ny - nh + end + elseif i % 4 == 1 then + nx = nx + nw + elseif i % 4 == 2 then + ny = ny + nh + elseif i % 4 == 3 then + if dwindle then + nx = nx + nw + else + nx = nx - nw + end + end + if i == 0 then + ny = wa.y + end + i = i + 1 + end + local geom = { x = nx, y = ny, width = nw, height = nh } + c:geometry(geom) + end +end + +--- Dwindle layout +dwindle = {} +dwindle.name = "dwindle" +function dwindle.arrange(p) + return spiral(p, true) +end + +--- Spiral layout +name = "spiral" +function arrange(p) + return spiral(p, false) +end + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 -- 1.6.3.3