diff --git a/lib/naughty/notification.lua b/lib/naughty/notification.lua index 3164b665..4e602a52 100644 --- a/lib/naughty/notification.lua +++ b/lib/naughty/notification.lua @@ -503,6 +503,13 @@ function notification:reset_timeout(new_timeout) -- timer before the constructor ends. if new_timeout and self.timer then self.timeout = new_timeout + elseif new_timeout and new_timeout ~= self._private.timeout then + local previous_timer = self._private.timeout + timer.delayed_call(function() + if self._private.timeout == previous_timer then + self.timeout = new_timeout + end + end) end if self.timer and not self.timer.started then diff --git a/tests/test-naughty-legacy.lua b/tests/test-naughty-legacy.lua index 7d716e37..ee81ea10 100644 --- a/tests/test-naughty-legacy.lua +++ b/tests/test-naughty-legacy.lua @@ -1076,7 +1076,14 @@ table.insert(steps, function() assert(naughty.get_by_id(42) ~= n) -- The timeout + local real, called = n.reset_timeout, false + n.reset_timeout = function(...) + called = true + return real(...) + end naughty.reset_timeout(n, 1337) + assert(called) + assert(n.timer and n.timer.started) -- Destroy using the old API local old_count = #destroyed