[+CC: Uli]

On Sun, May 6, 2012 at 6:35 AM, Anurag Priyam <[email protected]> wrote:
> On Sun, May 6, 2012 at 4:25 AM, Gerald Klein <[email protected]> wrote:
>> /usr/share/awesome/lib/wibox/init.lua:136 attempt to index local 'c' (a nil
>> value)
>
> Do you have bg_focus and bg_normal keys in your theme file?

Even otherwise there is something fishy about `set_bg` function.  The
doc says the color can be nil, but it fails to use a default if no
color argument was given.

Uli, what's with the `colstr` variable?  It doesn't seem to be used
anywhere.  Same for the `if c:get_type()` block.  Doesn't look like
anything is being done with the rgba values that it computes.  I
wonder if this (attached patch) is the right approach:


 function set_bg(wibox, c)
-    local c = c
-    local colstr = "#000000" -- Default if we can't figure out the color
+    local c = c or "#000000"
     if type(c) == "string" or type(c) == "table" then
         c = color(c)
     end
@@ -137,7 +136,7 @@ function set_bg(wibox, c)
         local r, g, b, a = c:get_rgba()
         r, g, b, a = r * 255, g * 255, b * 255, a * 255
         -- Alpha isn't supported for backgrounds
-        colstr = string_format("#%02x%02x%02x", r, g, b)
+        c = string_format("#%02x%02x%02x", r, g, b)
     end
     wibox.background_color = c
     wibox.draw()

Is that `if c:get_type()` block even necessary now that wiboxes
support pseudo-transparency (SHA:
5c7a3501d01a22f6cf4637bc057b46598e41e69a)?

-- 
Anurag Priyam

Attachment: 0001-wibox-assume-a-default-background-color-in-set_bg-if.patch
Description: Binary data

Reply via email to