X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/8af4a03c754fa1bcac24736633f1b3be8ce8888c..74f4507743e694cc17b85746247ec7a816d6924d:/util/init.lua diff --git a/util/init.lua b/util/init.lua index 26f50ae..4e82cd7 100644 --- a/util/init.lua +++ b/util/init.lua @@ -84,17 +84,21 @@ end -- Magnify a client: Set it to "float" and resize it. function util.magnify_client(c) - awful.client.floating.set(c, true) - - local mg = screen[mouse.screen].geometry - local tag = awful.tag.selected(mouse.screen) - local mwfact = awful.tag.getmwfact(tag) - local g = {} - g.width = math.sqrt(mwfact) * mg.width - g.height = math.sqrt(mwfact) * mg.height - g.x = mg.x + (mg.width - g.width) / 2 - g.y = mg.y + (mg.height - g.height) / 2 - c:geometry(g) + if not awful.client.floating.get(c) then + awful.client.floating.set(c, true) + + local mg = screen[mouse.screen].geometry + local tag = awful.tag.selected(mouse.screen) + local mwfact = awful.tag.getmwfact(tag) + local g = {} + g.width = math.sqrt(mwfact) * mg.width + g.height = math.sqrt(mwfact) * mg.height + g.x = mg.x + (mg.width - g.width) / 2 + g.y = mg.y + (mg.height - g.height) / 2 + c:geometry(g) + else + awful.client.floating.set(c, false) + end end -- Read the nice value of pid from /proc. @@ -171,4 +175,12 @@ function util.prompt_rename_tag(mypromptbox) end) end +-- On the fly useless gaps change +function util.useless_gaps_resize(thatmuch) + if beautiful.useless_gap_width then + beautiful.useless_gap_width = tonumber(beautiful.useless_gap_width) + thatmuch + awful.layout.arrange(mouse.screen) + end +end + return setmetatable(util, { __index = wrequire })