-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 = 5,
+ screen = alsabar.notifications.screen,
+ font = string.format("%s %s", alsabar.notifications.font,
+ alsabar.notifications.font_size),
+ fg = alsabar.notifications.color
+ }
+
+ if alsabar._muted
+ then
+ preset.title = string.format("%s - Muted", alsabar.channel)
+ else
+ preset.title = string.format("%s - %s%%", alsabar.channel, alsabar._current_level)
+ end
+
+ int = math.modf((alsabar._current_level / 100) * awful.screen.focused().mywibox.height)
+ preset.text = string.format("[%s%s]", string.rep("|", int),
+ string.rep(" ", awful.screen.focused().mywibox.height - int))
+
+ if alsabar.followtag then
+ preset.screen = awful.screen.focused()
+ end
+
+ if alsabar._notify ~= nil then
+ alsabar._notify = naughty.notify ({
+ replaces_id = alsabar._notify.id,
+ preset = preset,
+ })
+ else
+ alsabar._notify = naughty.notify ({
+ preset = preset,
+ })
+ end