Treat certain layouts as single client for gaps (#1914)
When gap_single_client is set to 'false', no gap is used when only one client is shown in a tag. Since the max layout only ever shows one client at a time it makes sense to apply this setting for this layout regardless of the actual number of clients in that tag. Additionally, if the 'master_fill_policy' property is set to 'master_width_factor', then use a gap even if there is only one client visible and 'gap_single_client' is false.
This commit is contained in:
parent
140481a3e5
commit
458981710c
|
@ -164,8 +164,15 @@ function layout.parameters(t, screen)
|
||||||
gap_single_client = t.gap_single_client
|
gap_single_client = t.gap_single_client
|
||||||
end
|
end
|
||||||
|
|
||||||
local min_clients = gap_single_client and 1 or 2
|
local useless_gap = 0
|
||||||
local useless_gap = t and (#clients >= min_clients and t.gap or 0) or 0
|
if t then
|
||||||
|
local skip_gap = layout.get(screen).skip_gap or function(nclients)
|
||||||
|
return nclients < 2
|
||||||
|
end
|
||||||
|
if gap_single_client or not skip_gap(#clients, t) then
|
||||||
|
useless_gap = t.gap
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
p.workarea = screen:get_bounding_geometry {
|
p.workarea = screen:get_bounding_geometry {
|
||||||
honor_padding = true,
|
honor_padding = true,
|
||||||
|
|
|
@ -163,13 +163,18 @@ end
|
||||||
local corner = {}
|
local corner = {}
|
||||||
corner.row_privileged = false
|
corner.row_privileged = false
|
||||||
|
|
||||||
|
function corner.skip_gap(nclients, t)
|
||||||
|
return nclients == 1 and t.master_fill_policy == "expand"
|
||||||
|
end
|
||||||
|
|
||||||
--- Corner layout.
|
--- Corner layout.
|
||||||
-- Display master client in a corner of the screen, and slaves in one
|
-- Display master client in a corner of the screen, and slaves in one
|
||||||
-- column and one row around the master.
|
-- column and one row around the master.
|
||||||
-- @clientlayout awful.layout.suit.corner.nw
|
-- @clientlayout awful.layout.suit.corner.nw
|
||||||
corner.nw = {
|
corner.nw = {
|
||||||
name = "cornernw",
|
name = "cornernw",
|
||||||
arrange = function (p) return do_corner(p, "NW") end
|
arrange = function (p) return do_corner(p, "NW") end,
|
||||||
|
skip_gap = corner.skip_gap
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Corner layout.
|
--- Corner layout.
|
||||||
|
@ -178,7 +183,8 @@ corner.nw = {
|
||||||
-- @clientlayout awful.layout.suit.corner.ne
|
-- @clientlayout awful.layout.suit.corner.ne
|
||||||
corner.ne = {
|
corner.ne = {
|
||||||
name = "cornerne",
|
name = "cornerne",
|
||||||
arrange = function (p) return do_corner(p, "NE") end
|
arrange = function (p) return do_corner(p, "NE") end,
|
||||||
|
skip_gap = corner.skip_gap
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Corner layout.
|
--- Corner layout.
|
||||||
|
@ -187,7 +193,8 @@ corner.ne = {
|
||||||
-- @clientlayout awful.layout.suit.corner.sw
|
-- @clientlayout awful.layout.suit.corner.sw
|
||||||
corner.sw = {
|
corner.sw = {
|
||||||
name = "cornersw",
|
name = "cornersw",
|
||||||
arrange = function (p) return do_corner(p, "SW") end
|
arrange = function (p) return do_corner(p, "SW") end,
|
||||||
|
skip_gap = corner.skip_gap
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Corner layout.
|
--- Corner layout.
|
||||||
|
@ -196,7 +203,8 @@ corner.sw = {
|
||||||
-- @clientlayout awful.layout.suit.corner.se
|
-- @clientlayout awful.layout.suit.corner.se
|
||||||
corner.se = {
|
corner.se = {
|
||||||
name = "cornerse",
|
name = "cornerse",
|
||||||
arrange = function (p) return do_corner(p, "SE") end
|
arrange = function (p) return do_corner(p, "SE") end,
|
||||||
|
skip_gap = corner.skip_gap
|
||||||
}
|
}
|
||||||
|
|
||||||
return corner
|
return corner
|
||||||
|
|
|
@ -47,11 +47,15 @@ max.name = "max"
|
||||||
function max.arrange(p)
|
function max.arrange(p)
|
||||||
return fmax(p, false)
|
return fmax(p, false)
|
||||||
end
|
end
|
||||||
|
function max.skip_gap(nclients, t) -- luacheck: no unused args
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
--- Fullscreen layout.
|
--- Fullscreen layout.
|
||||||
-- @clientlayout awful.layout.suit.max.fullscreen
|
-- @clientlayout awful.layout.suit.max.fullscreen
|
||||||
max.fullscreen = {}
|
max.fullscreen = {}
|
||||||
max.fullscreen.name = "fullscreen"
|
max.fullscreen.name = "fullscreen"
|
||||||
|
max.fullscreen.skip_gap = max.skip_gap
|
||||||
function max.fullscreen.arrange(p)
|
function max.fullscreen.arrange(p)
|
||||||
return fmax(p, true)
|
return fmax(p, true)
|
||||||
end
|
end
|
||||||
|
|
|
@ -296,12 +296,17 @@ local function do_tile(param, orientation)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function tile.skip_gap(nclients, t)
|
||||||
|
return nclients == 1 and t.master_fill_policy == "expand"
|
||||||
|
end
|
||||||
|
|
||||||
--- The main tile algo, on the right.
|
--- The main tile algo, on the right.
|
||||||
-- @param screen The screen number to tile.
|
-- @param screen The screen number to tile.
|
||||||
-- @clientlayout awful.layout.suit.tile.right
|
-- @clientlayout awful.layout.suit.tile.right
|
||||||
tile.right = {}
|
tile.right = {}
|
||||||
tile.right.name = "tile"
|
tile.right.name = "tile"
|
||||||
tile.right.arrange = do_tile
|
tile.right.arrange = do_tile
|
||||||
|
tile.right.skip_gap = tile.skip_gap
|
||||||
function tile.right.mouse_resize_handler(c, corner, x, y)
|
function tile.right.mouse_resize_handler(c, corner, x, y)
|
||||||
return mouse_resize_handler(c, corner, x, y)
|
return mouse_resize_handler(c, corner, x, y)
|
||||||
end
|
end
|
||||||
|
@ -311,6 +316,7 @@ end
|
||||||
-- @clientlayout awful.layout.suit.tile.left
|
-- @clientlayout awful.layout.suit.tile.left
|
||||||
tile.left = {}
|
tile.left = {}
|
||||||
tile.left.name = "tileleft"
|
tile.left.name = "tileleft"
|
||||||
|
tile.left.skip_gap = tile.skip_gap
|
||||||
function tile.left.arrange(p)
|
function tile.left.arrange(p)
|
||||||
return do_tile(p, "left")
|
return do_tile(p, "left")
|
||||||
end
|
end
|
||||||
|
@ -323,6 +329,7 @@ end
|
||||||
-- @clientlayout awful.layout.suit.tile.bottom
|
-- @clientlayout awful.layout.suit.tile.bottom
|
||||||
tile.bottom = {}
|
tile.bottom = {}
|
||||||
tile.bottom.name = "tilebottom"
|
tile.bottom.name = "tilebottom"
|
||||||
|
tile.bottom.skip_gap = tile.skip_gap
|
||||||
function tile.bottom.arrange(p)
|
function tile.bottom.arrange(p)
|
||||||
return do_tile(p, "bottom")
|
return do_tile(p, "bottom")
|
||||||
end
|
end
|
||||||
|
@ -335,6 +342,7 @@ end
|
||||||
-- @clientlayout awful.layout.suit.tile.top
|
-- @clientlayout awful.layout.suit.tile.top
|
||||||
tile.top = {}
|
tile.top = {}
|
||||||
tile.top.name = "tiletop"
|
tile.top.name = "tiletop"
|
||||||
|
tile.top.skip_gap = tile.skip_gap
|
||||||
function tile.top.arrange(p)
|
function tile.top.arrange(p)
|
||||||
return do_tile(p, "top")
|
return do_tile(p, "top")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue