Reputation: 545
How to configure a shortcut key in awesome to toggle a client window vertical maximization to the left half of the screen (snap to left)?
Module awful.placement has an example that may help, but there is no mention on how to implement a toggle that would be able to maximize the client or restore it to its prior size and location.
Currently I have the following in rc.lua
:
clientkeys = gears.table.join(
-- ...
awful.key({ modkey, "Mod1" }, "Left",
function (c)
-- Simulate Windows 7 'edge snap' (also called aero snap) feature
local f = awful.placement.scale + awful.placement.left + awful.placement.maximize_vertically
f(c.focus, {honor_workarea=true, to_percent = 0.5})
end ,
{description = "maximize vertically to the left half of screen", group = "client"})
)
Upvotes: 0
Views: 456
Reputation: 9877
Are you looking for awful.placement.restore
? It seems to do be what you are looking for. However, the documentation says one has to "set[...] the right context
argument" for this, but does not mention which one that is.
I think it should be scale
since it is the first one in your chain, but I fail to see the logic in calling this chain "scale
".
To turn that into a toggle, you can "invent" a new client property. Something like this: if c.my_toggle then print("a") else print("b") end c.my_toggle = not c.my_toggle
. This way, the my_toggle
property tracks which function you have to call.
Upvotes: 1