Make notification timeout configurable

Feature requested originally by p-conrad in
https://github.com/stefano-m/awesome-pulseaudio_widget/pull/4
This commit is contained in:
Stefano Mazzucco 2018-12-02 21:52:37 +00:00
parent 948d98be90
commit b65db3a134
2 changed files with 9 additions and 1 deletions

View File

@ -88,6 +88,8 @@ Require the module:
-- require *after* `beautiful.init` or the theme will be inconsistent! -- require *after* `beautiful.init` or the theme will be inconsistent!
local pulse = require("pulseaudio_widget") local pulse = require("pulseaudio_widget")
-- Optionally, change the notification timeout default of 1 second to 5.
pulse.notification_timeout_seconds = 5
``` ```
Add the widget to your layout: Add the widget to your layout:

View File

@ -74,7 +74,12 @@ function widget:notify(v)
naughty.destroy(self.notification, naughty.notificationClosedReason.dismissedByCommand) naughty.destroy(self.notification, naughty.notificationClosedReason.dismissedByCommand)
end end
self.notification = naughty.notify({text=msg, timeout=1}) self.notification = naughty.notify(
{
text=msg,
timeout=self.notification_timeout_seconds
}
)
end end
@ -177,6 +182,7 @@ function widget:init()
end end
self.mixer = "pavucontrol" self.mixer = "pavucontrol"
self.notification_timeout_seconds = 1
self.connection = pulse.get_connection(address) self.connection = pulse.get_connection(address)
self.core = pulse.get_core(self.connection) self.core = pulse.get_core(self.connection)