awful: add maximize function

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-07-29 18:29:27 +02:00
parent f16cedc650
commit 4a47502e16
2 changed files with 14 additions and 0 deletions

View File

@ -195,6 +195,7 @@ keybinding({ modkey, "Control" }, "r", awesome.restart):add()
keybinding({ modkey, "Shift" }, "q", awesome.quit):add()
-- Client manipulation
keybinding({ modkey }, "m", awful.client.maximize):add()
keybinding({ modkey, "Shift" }, "c", function () client.focus_get():kill() end):add()
keybinding({ modkey }, "j", function () awful.client.focus(1); client.focus_get():raise() end):add()
keybinding({ modkey }, "k", function () awful.client.focus(-1); client.focus_get():raise() end):add()

View File

@ -145,6 +145,19 @@ function P.client.moveresize(x, y, w, h, c)
sel.coords = coords
end
--- Maximize a client to use the full workspace area.
-- @param c A client, or the focused one if nil.
function P.client.maximize(c)
local sel = c or client.focus_get()
if sel then
sel.floating = true
local ws = screen.workspace_get(sel.screen)
ws.width = ws.width - 2 * sel.border_width
ws.height = ws.height - 2 * sel.border_width
sel.coords = ws
end
end
--- Give the focus to a screen, and move pointer.
-- @param Screen number.
function P.screen.focus(i)