awful.placement: add centered placement
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
b5db8032f9
commit
7349fb56a8
|
@ -170,4 +170,13 @@ function under_mouse(c)
|
|||
y = m_coords.y - c_geometry.height / 2 })
|
||||
end
|
||||
|
||||
--- Place the client centered in the screen.
|
||||
-- @param c The client.
|
||||
function centered(c)
|
||||
local c_geometry = c:geometry()
|
||||
local s_geometry = capi.screen[c.screen].geometry
|
||||
c:geometry({ x = s_geometry.x + (s_geometry.width - c_geometry.width) / 2,
|
||||
y = s_geometry.y + (s_geometry.height - c_geometry.height) / 2 })
|
||||
end
|
||||
|
||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
Loading…
Reference in New Issue