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
local colors = {}
for _, key in ipairs(keys) do
colors[key] = awesome.xrdb_get_value("", key)
if not colors[key] then
gears_debug.print_warning("beautiful: can't get colorscheme from xrdb (using fallback).")
return fallback
end
if colors[key]:find("rgb:") then
colors[key] = "#"..colors[key]:gsub("[a]?rgb:", ""):gsub("/", "")
local color = awesome.xrdb_get_value("", key)
if color then
if color:find("rgb:") then
color = "#"..color:gsub("[a]?rgb:", ""):gsub("/", "")
end
else
gears_debug.print_warning(
"beautiful: can't get colorscheme from xrdb for value '"..key.."' (using fallback)."
)
color = fallback[key]
end
colors[key] = color
end
return colors
end