diff --git a/lib/naughty/action.lua b/lib/naughty/action.lua index 7a8755521..92078d744 100644 --- a/lib/naughty/action.lua +++ b/lib/naughty/action.lua @@ -57,7 +57,13 @@ local action = {} -- @propemits true false --- When a notification is invoked. +-- +-- Note that it is possible to call `:invoke()` without a notification object. +-- It is possible the `notification` parameter will be nil. +-- -- @signal invoked +-- @tparam naughty.action action The action. +-- @tparam naughty.notification|nil notification The notification, if known. function action:get_selected() return self._private.selected diff --git a/lib/naughty/list/actions.lua b/lib/naughty/list/actions.lua index 34deaf68e..c7664ce84 100644 --- a/lib/naughty/list/actions.lua +++ b/lib/naughty/list/actions.lua @@ -337,7 +337,10 @@ local function new(_, args) update_style(wdg) wdg._private.default_buttons = gtable.join( - abutton({ }, 1, function(a) a:invoke(args.notification) end) + abutton({ }, 1, function(a) + local notif = wdg._private.notification or args.notification + a:invoke(notif) + end) ) return wdg