diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 71c45b5dc..da88e2019 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -52,7 +52,7 @@ editor_cmd = terminal .. " -e " .. editor modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. -layouts = +local layouts = { awful.layout.suit.floating, awful.layout.suit.tile, diff --git a/lib/awful/layout/suit/fair.lua.in b/lib/awful/layout/suit/fair.lua.in index e8bc9a8b9..5de18e5e1 100644 --- a/lib/awful/layout/suit/fair.lua.in +++ b/lib/awful/layout/suit/fair.lua.in @@ -9,9 +9,10 @@ local ipairs = ipairs local math = math --- Fair layouts module for awful -module("awful.layout.suit.fair") +-- awful.layout.suit.fair +local fair = {} -local function fair(p, orientation) +local function do_fair(p, orientation) local wa = p.workarea local cls = p.clients @@ -61,15 +62,17 @@ end --- Horizontal fair layout. -- @param screen The screen to arrange. -horizontal = {} -horizontal.name = "fairh" -function horizontal.arrange(p) - return fair(p, "east") +fair.horizontal = {} +fair.horizontal.name = "fairh" +function fair.horizontal.arrange(p) + return do_fair(p, "east") end -- Vertical fair layout. -- @param screen The screen to arrange. -name = "fairv" -function arrange(p) - return fair(p, "south") +fair.name = "fairv" +function fair.arrange(p) + return do_fair(p, "south") end + +return fair diff --git a/lib/awful/layout/suit/floating.lua.in b/lib/awful/layout/suit/floating.lua.in index 6a6e12ac2..b7e271701 100644 --- a/lib/awful/layout/suit/floating.lua.in +++ b/lib/awful/layout/suit/floating.lua.in @@ -5,9 +5,12 @@ --------------------------------------------------------------------------- --- Dummy function for floating layout -module("awful.layout.suit.floating") +-- awful.layout.suit.floating +local floating = {} -function arrange() +function floating.arrange() end -name = "floating" +floating.name = "floating" + +return floating diff --git a/lib/awful/layout/suit/init.lua.in b/lib/awful/layout/suit/init.lua.in index d5d4e3f25..c5660521c 100644 --- a/lib/awful/layout/suit/init.lua.in +++ b/lib/awful/layout/suit/init.lua.in @@ -1,9 +1,11 @@ -require("awful.layout.suit.max") -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") + +return +{ + max = require("awful.layout.suit.max"); + tile = require("awful.layout.suit.tile"); + fair = require("awful.layout.suit.fair"); + floating = require("awful.layout.suit.floating"); + magnifier = require("awful.layout.suit.magnifier"); + spiral = require("awful.layout.suit.spiral"); +} diff --git a/lib/awful/layout/suit/magnifier.lua.in b/lib/awful/layout/suit/magnifier.lua.in index e0909241a..3ad0644e9 100644 --- a/lib/awful/layout/suit/magnifier.lua.in +++ b/lib/awful/layout/suit/magnifier.lua.in @@ -16,9 +16,10 @@ local capi = local client = require("awful.client") --- Magnifier layout module for awful -module("awful.layout.suit.magnifier") +-- awful.layout.suit.magnifier +local magnifier = {} -function arrange(p) +function magnifier.arrange(p) -- Fullscreen? local area = p.workarea local cls = p.clients @@ -102,4 +103,6 @@ function arrange(p) end end -name = "magnifier" +magnifier.name = "magnifier" + +return magnifier diff --git a/lib/awful/layout/suit/max.lua.in b/lib/awful/layout/suit/max.lua.in index ded195c9f..ffa813389 100644 --- a/lib/awful/layout/suit/max.lua.in +++ b/lib/awful/layout/suit/max.lua.in @@ -9,7 +9,8 @@ local pairs = pairs local client = require("awful.client") --- Maximized and fullscreen layouts module for awful -module("awful.layout.suit.max") +-- awful.layout.suit.max +local max = {} local function fmax(p, fs) -- Fullscreen? @@ -33,15 +34,17 @@ end --- Maximized layout. -- @param screen The screen to arrange. -name = "max" -function arrange(p) +max.name = "max" +function max.arrange(p) return fmax(p, false) end --- Fullscreen layout. -- @param screen The screen to arrange. -fullscreen = {} -fullscreen.name = "fullscreen" -function fullscreen.arrange(p) +max.fullscreen = {} +max.fullscreen.name = "fullscreen" +function max.fullscreen.arrange(p) return fmax(p, true) end + +return max diff --git a/lib/awful/layout/suit/spiral.lua.in b/lib/awful/layout/suit/spiral.lua.in index 011b5aaf3..f96a7d17d 100644 --- a/lib/awful/layout/suit/spiral.lua.in +++ b/lib/awful/layout/suit/spiral.lua.in @@ -8,9 +8,10 @@ -- Grab environment we need local ipairs = ipairs -module("awful.layout.suit.spiral") +-- awful.layout.suit.spiral +local spiral = {} -local function spiral(p, spiral) +local function do_spiral(p, _spiral) local wa = p.workarea local cls = p.clients local n = #cls @@ -24,17 +25,17 @@ local function spiral(p, spiral) end end - if k % 4 == 0 and spiral then + if k % 4 == 0 and _spiral then wa.x = wa.x - wa.width elseif k % 2 == 0 or - (k % 4 == 3 and k < n and spiral) then + (k % 4 == 3 and k < n and _spiral) then wa.x = wa.x + wa.width end - if k % 4 == 1 and k ~= 1 and spiral then + if k % 4 == 1 and k ~= 1 and _spiral then wa.y = wa.y - wa.height elseif k % 2 == 1 and k ~= 1 or - (k % 4 == 0 and k < n and spiral) then + (k % 4 == 0 and k < n and _spiral) then wa.y = wa.y + wa.height end @@ -49,16 +50,18 @@ local function spiral(p, spiral) end --- Dwindle layout -dwindle = {} -dwindle.name = "dwindle" -function dwindle.arrange(p) - return spiral(p, false) +spiral.dwindle = {} +spiral.dwindle.name = "dwindle" +function spiral.dwindle.arrange(p) + return do_spiral(p, false) end --- Spiral layout -name = "spiral" -function arrange(p) - return spiral(p, true) +spiral.name = "spiral" +function spiral.arrange(p) + return do_spiral(p, true) end +return spiral + -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/lib/awful/layout/suit/tile.lua.in b/lib/awful/layout/suit/tile.lua.in index ecf41e3fd..d70152e6a 100644 --- a/lib/awful/layout/suit/tile.lua.in +++ b/lib/awful/layout/suit/tile.lua.in @@ -12,7 +12,8 @@ local math = math local tag = require("awful.tag") --- Tiled layouts module for awful -module("awful.layout.suit.tile") +-- awful.layout.suit.tile +local tile = {} local function tile_group(cls, wa, orientation, fact, group) -- get our orientation right @@ -72,7 +73,7 @@ local function tile_group(cls, wa, orientation, fact, group) return used_size end -local function tile(param, orientation) +local function do_tile(param, orientation) local t = tag.selected(param.screen) orientation = orientation or "right" @@ -148,33 +149,35 @@ local function tile(param, orientation) end -right = {} -right.name = "tile" -right.arrange = tile +tile.right = {} +tile.right.name = "tile" +tile.right.arrange = do_tile --- The main tile algo, on left. -- @param screen The screen number to tile. -left = {} -left.name = "tileleft" -function left.arrange(p) - return tile(p, "left") +tile.left = {} +tile.left.name = "tileleft" +function tile.left.arrange(p) + return do_tile(p, "left") end --- The main tile algo, on bottom. -- @param screen The screen number to tile. -bottom = {} -bottom.name = "tilebottom" -function bottom.arrange(p) - return tile(p, "bottom") +tile.bottom = {} +tile.bottom.name = "tilebottom" +function tile.bottom.arrange(p) + return do_tile(p, "bottom") end --- The main tile algo, on top. -- @param screen The screen number to tile. -top = {} -top.name = "tiletop" -function top.arrange(p) - return tile(p, "top") +tile.top = {} +tile.top.name = "tiletop" +function tile.top.arrange(p) + return do_tile(p, "top") end -arrange = right.arrange -name = right.name +tile.arrange = tile.right.arrange +tile.name = tile.right.name + +return tile