diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in index 3f7a2fa0e..4a9887d94 100644 --- a/lib/awful/layout/init.lua.in +++ b/lib/awful/layout/init.lua.in @@ -59,28 +59,14 @@ end -- Register an arrange hook. local function on_arrange (screen) - get(screen)(screen) + get(screen).arrange(screen) end -local layouts_name = -{ - [suit.tile] = "tile", - [suit.tile.left] = "tileleft", - [suit.tile.bottom] = "tilebottom", - [suit.tile.top] = "tiletop", - [suit.fair] = "fairv", - [suit.fair.horizontal] = "fairh", - [suit.max] = "max", - [suit.max.fullscreen] = "fullscreen", - [suit.magnifier] = "magnifier", - [suit.floating] = "floating" -} - --- Get the current layout name. -- @param layout the layout name. -- @return The layout name. function getname(layout) - return layouts_name[layout] + return layout.name end hooks.arrange.register(on_arrange) diff --git a/lib/awful/layout/suit/fair.lua.in b/lib/awful/layout/suit/fair.lua.in index c925f1020..36f43ca89 100644 --- a/lib/awful/layout/suit/fair.lua.in +++ b/lib/awful/layout/suit/fair.lua.in @@ -5,7 +5,6 @@ --------------------------------------------------------------------------- -- Grab environment we need -local setmetatable = setmetatable local ipairs = ipairs local math = math local client = require("awful.client") @@ -63,16 +62,18 @@ local function fair(screen, orientation) end end end + --- Horizontal fair layout. -- @param screen The screen to arrange. -function horizontal(screen) - return fair(screen, "east") +horizontal = {} +horizontal.name = "fairh" +function horizontal.arrange(p) + return fair(p, "east") end -- Vertical fair layout. -- @param screen The screen to arrange. -local function fairv(_, screen) - return fair(screen, "south") +name = "fairv" +function arrange(p) + return fair(p, "south") end - -setmetatable(_M, { __call = fairv }) diff --git a/lib/awful/layout/suit/floating.lua.in b/lib/awful/layout/suit/floating.lua.in index d19038042..cec55f345 100644 --- a/lib/awful/layout/suit/floating.lua.in +++ b/lib/awful/layout/suit/floating.lua.in @@ -4,14 +4,11 @@ -- @release @AWESOME_VERSION@ --------------------------------------------------------------------------- --- Grab environment we need -local setmetatable = setmetatable - --- Dummy function for floating layout module("awful.layout.suit.floating") -local function floating(_, screen) +function arrange(screen) return nil end -setmetatable(_M, { __call = floating }) +name = "floating" diff --git a/lib/awful/layout/suit/magnifier.lua.in b/lib/awful/layout/suit/magnifier.lua.in index f0a7d3268..26e16289c 100644 --- a/lib/awful/layout/suit/magnifier.lua.in +++ b/lib/awful/layout/suit/magnifier.lua.in @@ -5,7 +5,6 @@ --------------------------------------------------------------------------- -- Grab environment we need -local setmetatable = setmetatable local ipairs = ipairs local math = math local tag = require("awful.tag") @@ -19,7 +18,7 @@ local client = require("awful.client") --- Magnifier layout module for awful module("awful.layout.suit.magnifier") -local function magnifier(_, screen) +function arrange(screen) -- Fullscreen? local area = capi.screen[screen].workarea local cls = client.tiled(screen) @@ -91,4 +90,4 @@ local function magnifier(_, screen) end end -setmetatable(_M, { __call = magnifier }) +name = "magnifier" diff --git a/lib/awful/layout/suit/max.lua.in b/lib/awful/layout/suit/max.lua.in index f3455c76c..ab4cb4cde 100644 --- a/lib/awful/layout/suit/max.lua.in +++ b/lib/awful/layout/suit/max.lua.in @@ -5,7 +5,6 @@ --------------------------------------------------------------------------- -- Grab environment we need -local setmetatable = setmetatable local pairs = pairs local client = require("awful.client") local capi = @@ -34,14 +33,15 @@ end --- Maximized layout. -- @param screen The screen to arrange. -local function max(_, screen) +name = "max" +function arrange(screen) return fmax(screen, false) end --- Fullscreen layout. -- @param screen The screen to arrange. -function fullscreen(screen) +fullscreen = {} +fullscreen.name = "fullscreen" +function fullscreen.arrange(screen) return fmax(screen, true) end - -setmetatable(_M, { __call = max }) diff --git a/lib/awful/layout/suit/tile.lua.in b/lib/awful/layout/suit/tile.lua.in index 9753ab6fb..c4355de26 100644 --- a/lib/awful/layout/suit/tile.lua.in +++ b/lib/awful/layout/suit/tile.lua.in @@ -7,7 +7,6 @@ --------------------------------------------------------------------------- -- Grab environment we need -local setmetatable = setmetatable local ipairs = ipairs local math = math local client = require("awful.client") @@ -79,7 +78,7 @@ local function tile_group(cls, wa, orientation, fact, group) end -local function tile(_, screen, orientation) +local function tile(screen, orientation) orientation = orientation or "right" -- this handles are different orientations @@ -156,22 +155,33 @@ local function tile(_, screen, orientation) end +right = {} +right.name = "tile" +right.arrange = tile + --- The main tile algo, on left. -- @param screen The screen number to tile. -function left(screen) - return tile(nil, screen, "left") +left = {} +left.name = "tileleft" +function left.arrange(screen) + return tile(screen, "left") end --- The main tile algo, on bottom. -- @param screen The screen number to tile. -function bottom(screen) - return tile(nil, screen, "bottom") +bottom = {} +bottom.name = "tilebottom" +function bottom.arrange(screen) + return tile(screen, "bottom") end --- The main tile algo, on top. -- @param screen The screen number to tile. -function top(screen) - return tile(nil, screen, "top") +top = {} +top.name = "tiletop" +function top.arrange(screen) + return tile(screen, "top") end -setmetatable(_M, { __call = tile }) +arrange = right.arrange +name = right.name