naughty: Set an action table even if the notification has none.

Less `if` in the code.
This commit is contained in:
Emmanuel Lepage Vallee 2019-03-04 17:01:36 -05:00
parent 7bf1a276ef
commit 9acc452b1e
2 changed files with 12 additions and 8 deletions

View File

@ -429,20 +429,20 @@ Code:
Whenever it can, Awesome tries to be asynchronous. This can take various form
depending on the situation. For example, the `connect_signal` method allows to
execute code when an event arrives. `awful.screen.connect_for_each_screen` also
allow to instantiate various elements when a new screen is added. In the later
allows to instantiate various elements when a new screen is added. In the later
case, it is why some widgets are added as properties to other objects instead of
being global variables like in previous versions of Awesome.
However, there is a case where this isn't enough an another abstract widget has
However, there is a case where this isn't enough and another abstract widget has
to be used. This concept is called the `widget_template` and is an optional
property of many widgets such as the `awful.widget.taglist`,
`awful.widget.tasklist` and `naughty.widget.box`. These templates are **table**
using the exact same syntax as the declarative widgets, but without the
`wibox.widget` prefix in front of the curly braces. These template represents
future widgets that will be created by their parent widget. This is necessary
for three reasons:
`awful.widget.tasklist` and `naughty.layout.box`. These templates are a
**table** using the exact same syntax as the declarative widgets, but without
the `wibox.widget` prefix in front of the curly braces. These templates
represents future widgets that will be created by their parent widget. This is
necessary for three reasons:
* The widget must create many instances of the template at different point in
* The widget must create many instances of the template at different points in
time.
* The widget data is only partially available and other fields must be set
at a later time (by the parent widget).

View File

@ -516,6 +516,10 @@ local function create(args)
private[k] = v
end
-- notif.actions should not be nil to allow cheching if there is actions
-- using the shorthand `if #notif.actions > 0 then`
private.actions = private.actions or {}
-- It's an automatic property
n.is_expired = false