diff --git a/lib/awful/widget/button.lua.in b/lib/awful/widget/button.lua.in index c1210b2f..93b6db08 100644 --- a/lib/awful/widget/button.lua.in +++ b/lib/awful/widget/button.lua.in @@ -8,6 +8,7 @@ local setmetatable = setmetatable local type = type local button = require("awful.button") local imagebox = require("wibox.widget.imagebox") +local widget = require("wibox.widget.base") local surface = require("gears.surface") local cairo = require("lgi").cairo local capi = { mouse = mouse } @@ -20,7 +21,9 @@ local button = { mt = {} } -- @param args Widget arguments. "image" is the image to display. -- @return A textbox widget configured as a button. function button.new(args) - if not args or not args.image then return end + if not args or not args.image then + return widget.empty_widget() + end local img_release = surface.load(args.image) local img_press = cairo.ImageSurface(cairo.Format.ARGB32, img_release.width, img_release.height) local cr = cairo.Context(img_press) diff --git a/lib/beautiful.lua.in b/lib/beautiful.lua.in index e8a800f5..cf91bfdf 100644 --- a/lib/beautiful.lua.in +++ b/lib/beautiful.lua.in @@ -28,7 +28,7 @@ local capi = local beautiful = { mt = {} } -- Local data -local theme +local theme = {} local descs = setmetatable({}, { __mode = 'k' }) local fonts = setmetatable({}, { __mode = 'v' }) local active_font diff --git a/lib/wibox/widget/base.lua.in b/lib/wibox/widget/base.lua.in index eea10a75..5c2dd47d 100644 --- a/lib/wibox/widget/base.lua.in +++ b/lib/wibox/widget/base.lua.in @@ -97,6 +97,14 @@ function base.make_widget(proxy) return ret end +--- Generate an empty widget which takes no space and displays nothing +function base.empty_widget() + local widget = base.make_widget() + widget.draw = function() end + widget.fit = function() return 0, 0 end + return widget +end + --- Do some sanity checking on widget. This function raises a lua error if -- widget is not a valid widget. function base.check_widget(widget) diff --git a/lib/wibox/widget/systray.lua.in b/lib/wibox/widget/systray.lua.in index 16a9fb91..f6cb6378 100644 --- a/lib/wibox/widget/systray.lua.in +++ b/lib/wibox/widget/systray.lua.in @@ -21,7 +21,7 @@ local base_size = nil function systray:draw(wibox, cr, width, height) local x, y, width, height = lbase.rect_to_device_geometry(cr, 0, 0, width, height) local num_entries = capi.awesome.systray() - local bg = beautiful.bg_systray or beautiful.bg_normal + local bg = beautiful.bg_systray or beautiful.bg_normal or "#000000" local in_dir, ortho, base if horizontal then