From 19a1ee6c16cddb5b312122be5be590682bfcf2a4 Mon Sep 17 00:00:00 2001 From: Yauhen Kirylau Date: Thu, 18 Jan 2018 04:43:15 +0100 Subject: [PATCH] fix(beautiful: xresources): don't return fallback colorscheme if only some of the values are missing (#2151) related to #2150 --- lib/beautiful/xresources.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/beautiful/xresources.lua b/lib/beautiful/xresources.lua index 9fb0d1417..087ab3c90 100644 --- a/lib/beautiful/xresources.lua +++ b/lib/beautiful/xresources.lua @@ -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