Fix errors from missing themes
This patch gets rid of lots of errors that happen when beautiful.init() is not called in the config. Most of them were missing default values. Thanks to panthar for reporting this. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
b7eb233aee
commit
c50d62749b
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue