diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in index 4a9887d9..8f08f887 100644 --- a/lib/awful/layout/init.lua.in +++ b/lib/awful/layout/init.lua.in @@ -9,6 +9,7 @@ local ipairs = ipairs local tag = require("awful.tag") local util = require("awful.util") local suit = require("awful.layout.suit") +local client = require("awful.client") local capi = { hooks = hooks, @@ -59,7 +60,16 @@ end -- Register an arrange hook. local function on_arrange (screen) - get(screen).arrange(screen) + local t = tag.selected(screen) + local p = {} + p.workarea = capi.screen[screen].workarea + p.geometry = capi.screen[screen].geometry + p.clients = client.tiled(screen) + p.ncol = tag.getncol(t) + p.nmaster = tag.getnmaster(t) + p.mwfact = tag.getmwfact(t) + p.tagdata = tag.getdata(t) + get(screen).arrange(p) end --- Get the current layout name. diff --git a/lib/awful/layout/suit/fair.lua.in b/lib/awful/layout/suit/fair.lua.in index 36f43ca8..24f92932 100644 --- a/lib/awful/layout/suit/fair.lua.in +++ b/lib/awful/layout/suit/fair.lua.in @@ -7,18 +7,13 @@ -- Grab environment we need local ipairs = ipairs local math = math -local client = require("awful.client") -local capi = -{ - screen = screen -} --- Fair layouts module for awful module("awful.layout.suit.fair") -local function fair(screen, orientation) - local wa = capi.screen[screen].workarea - local cls = client.tiled(screen) +local function fair(p, orientation) + local wa = p.workarea + local cls = p.clients if #cls > 0 then local cells = math.ceil(math.sqrt(#cls)) diff --git a/lib/awful/layout/suit/floating.lua.in b/lib/awful/layout/suit/floating.lua.in index cec55f34..af82faba 100644 --- a/lib/awful/layout/suit/floating.lua.in +++ b/lib/awful/layout/suit/floating.lua.in @@ -7,7 +7,7 @@ --- Dummy function for floating layout module("awful.layout.suit.floating") -function arrange(screen) +function arrange(p) return nil end diff --git a/lib/awful/layout/suit/magnifier.lua.in b/lib/awful/layout/suit/magnifier.lua.in index 26e16289..9b76448b 100644 --- a/lib/awful/layout/suit/magnifier.lua.in +++ b/lib/awful/layout/suit/magnifier.lua.in @@ -18,14 +18,12 @@ local client = require("awful.client") --- Magnifier layout module for awful module("awful.layout.suit.magnifier") -function arrange(screen) +function arrange(p) -- Fullscreen? - local area = capi.screen[screen].workarea - local cls = client.tiled(screen) + local area = p.workarea + local cls = p.clients local focus = capi.client.focus - local t = tag.selected(screen) - local mwfact = tag.getmwfact(t) - local fidx -- Focus client index in cls table + local mwfact = p.mwfact -- Check that the focused window is on the right screen if focus and focus.screen ~= screen then focus = nil end diff --git a/lib/awful/layout/suit/max.lua.in b/lib/awful/layout/suit/max.lua.in index ab4cb4cd..cec07499 100644 --- a/lib/awful/layout/suit/max.lua.in +++ b/lib/awful/layout/suit/max.lua.in @@ -7,41 +7,35 @@ -- Grab environment we need local pairs = pairs local client = require("awful.client") -local capi = -{ - screen = screen -} --- Maximized and fullscreen layouts module for awful module("awful.layout.suit.max") -local function fmax(screen, fs) +local function fmax(p, fs) -- Fullscreen? local area if fs then - area = capi.screen[screen].geometry + area = p.geometry else - area = capi.screen[screen].workarea + area = p.workarea end - for k, c in pairs(client.visible(screen)) do - if not client.floating.get(c) then - c:geometry(area) - end + for k, c in pairs(p.clients) do + c:geometry(area) end end --- Maximized layout. -- @param screen The screen to arrange. name = "max" -function arrange(screen) - return fmax(screen, false) +function arrange(p) + return fmax(p, false) end --- Fullscreen layout. -- @param screen The screen to arrange. fullscreen = {} fullscreen.name = "fullscreen" -function fullscreen.arrange(screen) - return fmax(screen, true) +function fullscreen.arrange(p) + return fmax(p, true) end diff --git a/lib/awful/layout/suit/tile.lua.in b/lib/awful/layout/suit/tile.lua.in index c4355de2..5d3a9a85 100644 --- a/lib/awful/layout/suit/tile.lua.in +++ b/lib/awful/layout/suit/tile.lua.in @@ -9,12 +9,6 @@ -- Grab environment we need local ipairs = ipairs local math = math -local client = require("awful.client") -local tag = require("awful.tag") -local capi = -{ - screen = screen -} --- Tiled layouts module for awful module("awful.layout.suit.tile") @@ -75,10 +69,9 @@ local function tile_group(cls, wa, orientation, fact, group) end return used_size - end -local function tile(screen, orientation) +local function tile(param, orientation) orientation = orientation or "right" -- this handles are different orientations @@ -93,23 +86,21 @@ local function tile(screen, orientation) y = "x" end - local t = tag.selected(screen) - local cls = client.tiled(screen) - local nmaster = math.min(tag.getnmaster(t), #cls) + local cls = param.clients + local nmaster = math.min(param.nmaster, #cls) local nother = math.max(#cls - nmaster,0) - local mwfact = tag.getmwfact(t) - local wa = capi.screen[screen].workarea - local ncol = tag.getncol(t) + local mwfact = param.mwfact + local wa = param.workarea + local ncol = param.ncol - local data = tag.getproperty(t,"windowfact") + local data = param.tagdata.windowfact if not data then data = {} - tag.setproperty(t,"windowfact", data) + param.tagdata.windowfact = data end - -- local coord = wa[x] local place_master = true if orientation == "left" or orientation == "top" then @@ -163,24 +154,24 @@ right.arrange = tile -- @param screen The screen number to tile. left = {} left.name = "tileleft" -function left.arrange(screen) - return tile(screen, "left") +function left.arrange(p) + return tile(p, "left") end --- The main tile algo, on bottom. -- @param screen The screen number to tile. bottom = {} bottom.name = "tilebottom" -function bottom.arrange(screen) - return tile(screen, "bottom") +function bottom.arrange(p) + return tile(p, "bottom") end --- The main tile algo, on top. -- @param screen The screen number to tile. top = {} top.name = "tiletop" -function top.arrange(screen) - return tile(screen, "top") +function top.arrange(p) + return tile(p, "top") end arrange = right.arrange diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index 8bc0094d..e4589d85 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -244,6 +244,13 @@ local function hook_tags(screen, tag, action) end end +--- Get tag data table. +-- @param tag The Tag. +-- @return The data table. +function getdata(tag) + return data.tags[tag] +end + --- Get a tag property. -- @param tag The tag. -- @param prop The property name.