From 4a47502e164c1e6d0419acd8b1b7261de882b2d3 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 29 Jul 2008 18:29:27 +0200 Subject: [PATCH] awful: add maximize function Signed-off-by: Julien Danjou --- awesomerc.lua.in | 1 + lib/awful.lua.in | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/awesomerc.lua.in b/awesomerc.lua.in index f2407162..0b9f35e8 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -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() diff --git a/lib/awful.lua.in b/lib/awful.lua.in index d2bcc76a..97bc977f 100644 --- a/lib/awful.lua.in +++ b/lib/awful.lua.in @@ -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)