Restore the ability to resize tiled clients.

This backport previously deleted code. The upstreamed solution was
never merged, so better bring this back, even with the limitations.
This commit is contained in:
Emmanuel Lepage Vallee 2021-12-08 11:33:56 -08:00
parent bd4f3de7f1
commit efdfc43d29
1 changed files with 29 additions and 5 deletions

View File

@ -11,10 +11,10 @@ local values = {"top" , "top_right" , "right" , "bottom_right" ,
"bottom" , "bottom_left", "left" , "top_left" } "bottom" , "bottom_left", "left" , "top_left" }
local invert = { local invert = {
left = "right", left = "right",
right = "left" , right = "left" ,
up = "down" , up = "down" ,
down = "up" , down = "up" ,
} }
local r_ajust = { local r_ajust = {
@ -24,6 +24,18 @@ local r_ajust = {
down = function(c, d) return { height = c.height + d, } end, down = function(c, d) return { height = c.height + d, } end,
} }
-- Resize tiled using the keyboard
local layouts_all = {
[awful.layout.suit.floating] = { right = "" },
[awful.layout.suit.tile] = { right = {mwfact= 0.05}, left = {mwfact=-0.05}, up ={wfact=-0.1 }, down = {wfact = 0.1 } },
[awful.layout.suit.tile.left] = { right = {mwfact=-0.05}, left = {mwfact= 0.05}, up ={wfact= 0.1 }, down = {wfact =-0.1 } },
[awful.layout.suit.tile.bottom] = { right = {wfact=-0.1 }, left = {wfact= 0.1 }, up ={mwfact=-0.05}, down = {mwfact= 0.05} },
[awful.layout.suit.tile.top] = { right = {wfact=-0.1 }, left = {wfact= 0.1 }, up ={mwfact= 0.05}, down = {mwfact=-0.05} },
[awful.layout.suit.spiral] = { right = {wfact=-0.1 }, left = {wfact= 0.1 }, up ={mwfact= 0.05}, down = {mwfact=-0.05} },
[awful.layout.suit.magnifier] = { right = {mwfact= 0.05}, left = {mwfact=-0.05}, up ={mwfact= 0.05}, down = {mwfact=-0.05} },
-- The other layouts cannot be resized using variables
}
local function create_indicators() local function create_indicators()
local ret = {} local ret = {}
local angle = -((2*math.pi)/8) local angle = -((2*math.pi)/8)
@ -132,7 +144,19 @@ function module.resize(mod,key,event,direction,is_swap,is_max)
local del = is_swap and -100 or 100 local del = is_swap and -100 or 100
direction = is_swap and invert[direction] or direction direction = is_swap and invert[direction] or direction
c:emit_signal("request::geometry", "mouse.resize", r_ajust[direction](c, del)) local lay = awful.layout.get(c.screen)
if c.floating or lay == awful.layout.suit.floating then
c:emit_signal("request::geometry", "mouse.resize", r_ajust[direction](c, del))
elseif layouts_all[lay] then
local ret = layouts_all[lay][direction]
if ret.mwfact then
awful.tag.incmwfact(ret.mwfact)
end
if ret.wfact then
awful.client.incwfact(ret.wfact, c)
end
end
return true return true
end end