X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/c0deea25035a845907210f2a913099343a16162e..b14eff9b1e5558b3d3ea47d5e6ac9d6db3d265de:/widgets/pulsebar.lua?ds=sidebyside diff --git a/widgets/pulsebar.lua b/widgets/pulsebar.lua index 9380a34..c75ad4a 100644 --- a/widgets/pulsebar.lua +++ b/widgets/pulsebar.lua @@ -13,6 +13,7 @@ local naughty = require("naughty") local wibox = require("wibox") local math = { modf = math.modf } local string = { format = string.format, + gmatch = string.gmatch, match = string.match, rep = string.rep } local type = type @@ -50,8 +51,8 @@ local function worker(args) pulsebar.notifications = args.notification_preset if not pulsebar.notification_preset then - pulsebar.notification_preset = naughty.config.defaults - pulsebar.notification_preset.font = "Monospace 11" + pulsebar.notification_preset = {} + pulsebar.notification_preset.font = "Monospace 10" end pulsebar.bar = wibox.widget { @@ -128,17 +129,18 @@ local function worker(args) if pulsebar.followtag then preset.screen = awful.screen.focused() end - pulsebar.id = naughty.notify ({ - replaces_id = pulsebar.id, - preset = preset - }).id + if not pulsebar.notification then + pulsebar.notification = naughty.notify { + preset = preset, + destroy = function() pulsebar.notification = nil end + } + else + naughty.replace_text(pulsebar.notification, preset.title, preset.text) + end end) end - - timer_id = string.format("pulsebar-%s", pulsebar.sink) - - helpers.newtimer(timer_id, timeout, pulsebar.update) + helpers.newtimer(string.format("pulsebar-%s", pulsebar.sink), timeout, pulsebar.update) return pulsebar end