fix(beautiful: xresources): don't return fallback colorscheme if only some of the values are missing (#2151)

related to #2150
This commit is contained in:
Yauhen Kirylau 2018-01-18 04:43:15 +01:00 committed by Emmanuel Lepage Vallée
parent ad68d3bf5b
commit 19a1ee6c16
1 changed files with 11 additions and 7 deletions

View File

@ -51,14 +51,18 @@ function xresources.get_current_theme()
for i=0,15 do table.insert(keys, "color"..i) end for i=0,15 do table.insert(keys, "color"..i) end
local colors = {} local colors = {}
for _, key in ipairs(keys) do for _, key in ipairs(keys) do
colors[key] = awesome.xrdb_get_value("", key) local color = awesome.xrdb_get_value("", key)
if not colors[key] then if color then
gears_debug.print_warning("beautiful: can't get colorscheme from xrdb (using fallback).") if color:find("rgb:") then
return fallback color = "#"..color:gsub("[a]?rgb:", ""):gsub("/", "")
end end
if colors[key]:find("rgb:") then else
colors[key] = "#"..colors[key]:gsub("[a]?rgb:", ""):gsub("/", "") gears_debug.print_warning(
"beautiful: can't get colorscheme from xrdb for value '"..key.."' (using fallback)."
)
color = fallback[key]
end end
colors[key] = color
end end
return colors return colors
end end