Browse Source

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

related to #2150
Yauhen Kirylau 1 year ago
parent
commit
19a1ee6c16
1 changed files with 11 additions and 7 deletions
  1. 11
    7
      lib/beautiful/xresources.lua

+ 11
- 7
lib/beautiful/xresources.lua View File

@@ -51,14 +51,18 @@ function xresources.get_current_theme()
51 51
     for i=0,15 do table.insert(keys, "color"..i) end
52 52
     local colors = {}
53 53
     for _, key in ipairs(keys) do
54
-        colors[key] = awesome.xrdb_get_value("", key)
55
-        if not colors[key] then
56
-            gears_debug.print_warning("beautiful: can't get colorscheme from xrdb (using fallback).")
57
-            return fallback
58
-        end
59
-        if colors[key]:find("rgb:") then
60
-            colors[key] = "#"..colors[key]:gsub("[a]?rgb:", ""):gsub("/", "")
54
+        local color = awesome.xrdb_get_value("", key)
55
+        if color then
56
+            if color:find("rgb:") then
57
+                color = "#"..color:gsub("[a]?rgb:", ""):gsub("/", "")
58
+            end
59
+        else
60
+            gears_debug.print_warning(
61
+                "beautiful: can't get colorscheme from xrdb for value '"..key.."' (using fallback)."
62
+            )
63
+            color = fallback[key]
61 64
         end
65
+        colors[key] = color
62 66
     end
63 67
     return colors
64 68
 end

Loading…
Cancel
Save