From ab7788e2f5208d7bb49c27c9cee1bf961ca56fbf Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 5 Jun 2012 16:20:30 +0200 Subject: [PATCH] Fix naughty notifications Commit d14d6959ea7d83 caused every notify() call to fail with 'attempt to compare number with nil' because the default_preset table no longer exists. Signed-off-by: Uli Schlachter --- lib/naughty.lua.in | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index 98cf9f325..619ddd91e 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -33,8 +33,6 @@ module("naughty") -- Default: { "/usr/share/pixmaps/", } -- @field icon_formats List of formats that will be checked by getIcon() -- Default: { "png", "gif" } --- @field default_preset Preset to be used by default. --- Default: config.presets.normal -- @field notify_callback Callback used to modify or reject notifications. -- Default: nil -- Example: @@ -75,10 +73,10 @@ config.presets = { } } --- @name config.defaults --- holds the default values for the parameters to @see notify(). These --- can optionally be overridden by specifying a preset (@see config.presets) --- @class table +--- Default values for the params to notify(). +-- These can optionally be overridden by specifying a preset +-- @see config.presets +-- @see notify config.defaults = { timeout = 5, text = "", @@ -292,7 +290,7 @@ function notify(args) end -- gather variables together - local preset = util.table.join(config.default_preset or {}, + local preset = util.table.join(config.defaults or {}, args.preset or config.presets.normal or {}) local timeout = args.timeout or preset.timeout local icon = args.icon or preset.icon @@ -505,7 +503,7 @@ end -- Notify if capi.dbus then capi.dbus.connect_signal("org.freedesktop.Notifications", function (data, appname, replaces_id, icon, title, text, actions, hints, expire) - args = { preset = config.default_preset } + args = { } if data.member == "Notify" then if text ~= "" then args.text = text