client.border_color: Fix a bug affecting floating clients.

If client client was tiled, the `fallback` could be
`theme.border_color_normal`, but if the client was
tiled, this fallback was never tried.

Now it tests for both "floating" and "active" fallbacks.

This problem actually affects the default theme.
This commit is contained in:
Emmanuel Lepage Vallee 2021-10-24 20:46:22 -07:00
parent ebc9b99ae2
commit 11e4fe88bb
1 changed files with 22 additions and 13 deletions

View File

@ -608,31 +608,32 @@ end, "mouse_enter")
function permissions.update_border(c, context) function permissions.update_border(c, context)
if not pcommon.check(c, "client", "border", context) then return end if not pcommon.check(c, "client", "border", context) then return end
local suffix, fallback = "", "" local suffix, fallback1, fallback2 = "", ""
-- Add the sub-namespace. -- Add the sub-namespace.
if c.fullscreen then if c.fullscreen then
suffix, fallback = "_fullscreen", "_fullscreen" suffix, fallback1 = "_fullscreen", "_fullscreen"
elseif c.maximized then elseif c.maximized then
suffix, fallback = "_maximized", "_maximized" suffix, fallback1 = "_maximized", "_maximized"
elseif c.floating then elseif c.floating then
suffix, fallback = "_floating", "_floating" suffix, fallback1 = "_floating", "_floating"
end end
-- Add the state suffix. -- Add the state suffix.
if c.urgent then if c.urgent then
suffix = suffix .. "_urgent" suffix, fallback2 = suffix .. "_urgent", "_urgent"
elseif c.active then elseif c.active then
suffix = suffix .. "_active" suffix, fallback2 = suffix .. "_active", "_active"
elseif context == "added" then elseif context == "added" then
suffix = suffix .. "_new" suffix, fallback2 = suffix .. "_new", "_new"
else else
suffix = suffix .. "_normal" suffix, fallback2 = suffix .. "_normal", "_normal"
end end
if not c._private._user_border_width then if not c._private._user_border_width then
c._border_width = beautiful["border_width"..suffix] c._border_width = beautiful["border_width"..suffix]
or beautiful["border_width"..fallback] or beautiful["border_width"..fallback1]
or beautiful["border_width"..fallback2]
or beautiful.border_width or beautiful.border_width
end end
@ -657,8 +658,12 @@ function permissions.update_border(c, context)
local tv = beautiful["border_color"..suffix] local tv = beautiful["border_color"..suffix]
if fallback ~= "" and not tv then if (not tv) and fallback1 ~= "" then
tv = beautiful["border_color"..fallback] tv = beautiful["border_color"..fallback1]
end
if (not tv) and (fallback2 ~= "") then
tv = beautiful["border_color"..fallback2]
end end
-- The old theme variable did not have "color" in its name. -- The old theme variable did not have "color" in its name.
@ -688,8 +693,12 @@ function permissions.update_border(c, context)
if not c._private._user_opacity then if not c._private._user_opacity then
local tv = beautiful["opacity"..suffix] local tv = beautiful["opacity"..suffix]
if fallback ~= "" and not tv then if fallback1 ~= "" and not tv then
tv = beautiful["opacity"..fallback] tv = beautiful["opacity"..fallback1]
end
if fallback2 ~= "" and not tv then
tv = beautiful["opacity"..fallback2]
end end
if tv then if tv then