-function alsabar:notify()
- local preset =
- {
- title = "", text = "",
- timeout = 15,
- font = alsabar.notifications.font .. " " .. alsabar.notifications.font_size,
- fg = alsabar.notifications.color
- }
-
- if alsabar._muted then
- preset.title = alsabar.channel .. " - Muted"
- else
- preset.title = alsabar.channel .. " - " .. alsabar._current_level * 100 .. "%"
- end
-
- local int = math.modf(alsabar._current_level * alsabar.notifications.bar_size)
- preset.text = "[" .. string.rep("|", int)
- .. string.rep(" ", alsabar.notifications.bar_size - int) .. "]"
-
- if alsabar._notify ~= nil then
- alsabar._notify = naughty.notify ({ replaces_id = alsabar._notify.id,
- preset = preset })
- else
- alsabar._notify = naughty.notify ({ preset = preset })
- end
+function alsabar.notify()
+ alsabar.update()
+
+ local preset = {
+ title = "",
+ text = "",
+ timeout = 4,
+ font = alsabar.notifications.font .. " " ..
+ alsabar.notifications.font_size,
+ fg = alsabar.notifications.color
+ }
+
+ if alsabar._muted
+ then
+ preset.title = alsabar.channel .. " - Muted"
+ else
+ preset.title = alsabar.channel .. " - " .. alsabar._current_level .. "%"
+ end
+
+ int = math.modf((alsabar._current_level / 100) * alsabar.notifications.bar_size)
+ preset.text = "["
+ .. string.rep("|", int)
+ .. string.rep(" ", alsabar.notifications.bar_size - int)
+ .. "]"
+
+ if alsabar._notify ~= nil then
+ alsabar._notify = naughty.notify ({
+ replaces_id = alsabar._notify.id,
+ preset = preset,
+ })
+ else
+ alsabar._notify = naughty.notify ({
+ preset = preset,
+ })
+ end