awesome/lib/awful/layout/suit/max.lua.in

52 lines
1.3 KiB
Lua

---------------------------------------------------------------------------
-- @author Julien Danjou <julien@danjou.info>
-- @copyright 2008 Julien Danjou
-- @release @AWESOME_VERSION@
---------------------------------------------------------------------------
-- Grab environment we need
local setmetatable = setmetatable
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)
-- Fullscreen?
local area
if fs then
area = capi.screen[screen].geometry
else
area = capi.screen[screen].workarea
end
for k, c in pairs(client.visible(screen)) do
if not client.floating.get(c) then
area.width = area.width - 2 * c.border_width
area.height = area.height - 2 * c.border_width
c:fullgeometry(area)
area.width = area.width + 2 * c.border_width
area.height = area.height + 2 * c.border_width
end
end
end
--- Maximized layout.
-- @param screen The screen to arrange.
local function max(_, screen)
return fmax(screen, false)
end
--- Fullscreen layout.
-- @param screen The screen to arrange.
function fullscreen(screen)
return fmax(screen, true)
end
setmetatable(_M, { __call = max })