From b65db3a13454c0fddae816e45a2593d34b1481b3 Mon Sep 17 00:00:00 2001 From: Stefano Mazzucco Date: Sun, 2 Dec 2018 21:52:37 +0000 Subject: [PATCH] Make notification timeout configurable Feature requested originally by p-conrad in https://github.com/stefano-m/awesome-pulseaudio_widget/pull/4 --- README.md | 2 ++ pulseaudio_widget.lua | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c4bdbda..64fadf6 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,8 @@ Require the module: -- require *after* `beautiful.init` or the theme will be inconsistent! 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: diff --git a/pulseaudio_widget.lua b/pulseaudio_widget.lua index 71eaf92..ba3923e 100644 --- a/pulseaudio_widget.lua +++ b/pulseaudio_widget.lua @@ -74,7 +74,12 @@ function widget:notify(v) naughty.destroy(self.notification, naughty.notificationClosedReason.dismissedByCommand) end - self.notification = naughty.notify({text=msg, timeout=1}) + self.notification = naughty.notify( + { + text=msg, + timeout=self.notification_timeout_seconds + } + ) end @@ -177,6 +182,7 @@ function widget:init() end self.mixer = "pavucontrol" + self.notification_timeout_seconds = 1 self.connection = pulse.get_connection(address) self.core = pulse.get_core(self.connection)