wibar: Allow to configure how conflicts between wibars are resolved.

Previously, the horizontal wibars would always get priority. Now,
this can be configured.
This commit is contained in:
Emmanuel Lepage Vallee 2021-07-05 22:18:28 -07:00
parent 529a6c2a8d
commit b883855272
1 changed files with 9 additions and 1 deletions

View File

@ -100,6 +100,11 @@ local align_map = {
-- @see client.struts -- @see client.struts
-- @see screen.workarea -- @see screen.workarea
--- If there is both vertical and horizontal wibar, give more space to vertical ones.
--
-- @beautiful beautiful.wibar_favor_vertical
-- @tparam[opt=false] boolean favor_vertical
--- The wibar border width. --- The wibar border width.
-- @beautiful beautiful.wibar_border_width -- @beautiful beautiful.wibar_border_width
-- @tparam integer border_width -- @tparam integer border_width
@ -193,9 +198,12 @@ local function get_margins(w)
margins[position] = margins[position] + get_margin(w, position, true) margins[position] = margins[position] + get_margin(w, position, true)
-- Avoid overlapping wibars -- Avoid overlapping wibars
if position == "left" or position == "right" then if (position == "left" or position == "right") and not beautiful.wibar_favor_vertical then
margins.top = get_margin(w, "top" ) margins.top = get_margin(w, "top" )
margins.bottom = get_margin(w, "bottom") margins.bottom = get_margin(w, "bottom")
elseif (position == "top" or position == "bottom") and beautiful.wibar_favor_vertical then
margins.left = get_margin(w, "left" )
margins.right = get_margin(w, "right")
end end
return margins return margins