ruled.notifications: Add an implicit timeout to the rules.

This replaces the old preset one.
This commit is contained in:
Emmanuel Lepage Vallee 2020-02-15 21:45:35 -05:00
parent 2d477383ee
commit cab352781d
1 changed files with 15 additions and 0 deletions

View File

@ -64,6 +64,14 @@ local naughty = require("naughty")
-- @clientruleproperty append_actions
-- @param table
--- Set a fallback timeout the notification has no explicit timeout.
--
-- The value is in seconds. If none is specified, the default is 5 seconds. If
-- the notification specifies its own timeout, this property will be skipped.
--
-- @clientruleproperty implicit_timeout
-- @param number
local nrules = matcher()
local function client_match_common(n, prop, value)
@ -107,6 +115,13 @@ nrules:add_property_setter("append_actions", function(n, value)
n.actions = gtable.merge(new_actions, value)
end)
nrules:add_property_setter("implicit_timeout", function(n, value)
-- Check if there is an explicit timeout.
if not n._private.timeout then
n.timeout = value
end
end)
local module = {}
gobject._setup_class_signals(module)