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 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 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 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 case, it is why some widgets are added as properties to other objects instead of
being global variables like in previous versions of Awesome. 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 to be used. This concept is called the `widget_template` and is an optional
property of many widgets such as the `awful.widget.taglist`, property of many widgets such as the `awful.widget.taglist`,
`awful.widget.tasklist` and `naughty.widget.box`. These templates are **table** `awful.widget.tasklist` and `naughty.layout.box`. These templates are a
using the exact same syntax as the declarative widgets, but without the **table** using the exact same syntax as the declarative widgets, but without
`wibox.widget` prefix in front of the curly braces. These template represents the `wibox.widget` prefix in front of the curly braces. These templates
future widgets that will be created by their parent widget. This is necessary represents future widgets that will be created by their parent widget. This is
for three reasons: 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. time.
* The widget data is only partially available and other fields must be set * The widget data is only partially available and other fields must be set
at a later time (by the parent widget). at a later time (by the parent widget).

View File

@ -516,6 +516,10 @@ local function create(args)
private[k] = v private[k] = v
end 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 -- It's an automatic property
n.is_expired = false n.is_expired = false