gap_mult_client support

This commit is contained in:
h 2022-04-04 15:24:46 +08:00
parent c539e0e435
commit 71d3ea6caf
2 changed files with 31 additions and 1 deletions

View File

@ -182,12 +182,18 @@ function layout.parameters(t, screen)
gap_single_client = t.gap_single_client
end
local gap_mult_client = true
if(t and t.gap_mult_client ~= nil) then
gap_mult_client = t.gap_mult_client
end
local useless_gap = 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
if (gap_single_client and skip_gap(#clients, t)) or (not skip_gap(#clients, t) and gap_mult_client) then
useless_gap = t.gap
end
end

View File

@ -50,6 +50,7 @@ defaults.gap = 0
-- The default gap_count.
defaults.gap_single_client = true
defaults.gap_mult_client = true
-- The default master fill policy.
defaults.master_fill_policy = "expand"
@ -1173,6 +1174,29 @@ function tag.object.get_gap_single_client(t)
return defaults.gap_single_client
end
--- Enable gaps for mult client.
--
-- @beautiful beautiful.gap_mult_client
-- @param boolean (default: true)
-- @see gap
-- @see gap_single_client
function tag.object.set_gap_mult_client(t, gap_mult_client)
tag.setproperty(t, "gap_mult_client", gap_mult_client == true)
end
function tag.object.get_gap_mult_client(t)
local val = tag.getproperty(t, "gap_mult_client")
if val ~= nil then
return val
end
val = beautiful.gap_mult_client
if val ~= nil then
return val
end
return defaults.gap_mult_client
end
--- Get the spacing between clients.
-- @deprecated awful.tag.getgap
-- @see gap