@@ -31,17 +31,15 @@ call ``vicious.register`` to register it with Vicious:
3131 :param widget: awesome widget created from
3232 ``awful.widget `` or ``wibox.widget ``
3333
34- :param wtype:
35- either of
34+ :param wtype: either of
3635
3736 * Vicious widget type: any widget type
3837 :ref: `provided by Vicious <widgets >` or customly defined.
3938 * ``function ``: custom function from your own
4039 awesome configuration can be registered as widget types
4140 (see :ref: `custom-wtype `).
4241
43- :param format:
44- either of
42+ :param format: either of
4543
4644 * string: ``$key `` will be replaced by respective value in the table
4745 ``t `` returned by the widget type, i.e. use ``$1 ``, ``$2 ``, etc.
@@ -105,25 +103,23 @@ vicious.force
105103
106104 :param wtable: table of one or more widgets to be updated
107105
108- vicious.call
109- ------------
106+ vicious.call[_async]
107+ --------------------
110108
111109.. lua :function :: vicious.call(wtype, format, warg)
112110
113- Fetch data from the widget type to use it outside of the widget
111+ Get formatted data from a synchronous widget type
114112 (:ref: `example <call-example >`).
115113
116- :param wtype:
117- either of
114+ :param wtype: either of
118115
119- * Vicious widget type: any widget type
116+ * Vicious widget type: any synchronous widget type
120117 :ref: `provided by Vicious <widgets >` or customly defined.
121118 * ``function ``: custom function from your own
122119 awesome configuration can be registered as widget types
123120 (see :ref: `custom-wtype `).
124121
125- :param format:
126- either of
122+ :param format: either of
127123
128124 * string: ``$key `` will be replaced by respective value in the table
129125 ``t `` returned by the widget type, i.e. use ``$1 ``, ``$2 ``, etc.
@@ -132,7 +128,32 @@ vicious.call
132128 * ``function (widget, args) `` can be used to manipulate data returned
133129 by the widget type (see :ref: `format-func `).
134130
135- :param warg: arguments to be passed to widget types, e.g. the battery ID.
131+ :param warg: arguments to be passed to the widget type, e.g. the battery ID.
132+
133+ :return: ``nil `` if the widget type is asynchronous,
134+ otherwise the formatted data from with widget type.
135+
136+ .. lua :function :: vicious.call_async(wtype, format, warg, callback)
137+
138+ Get formatted data from an asynchronous widget type.
139+
140+ :param wtype: any asynchronous widget type
141+ :ref: `provided by Vicious <widgets >` or customly defined.
142+
143+ :param format: either of
144+
145+ * string: ``$key `` will be replaced by respective value in the table
146+ ``t `` returned by the widget type, i.e. use ``$1 ``, ``$2 ``, etc.
147+ to retrieve data from an integer-indexed table (a.k.a. array);
148+ ``${foo bar} `` will be substituted by ``t["{foo bar}"] ``.
149+ * ``function (widget, args) `` can be used to manipulate data returned
150+ by the widget type (see :ref: `format-func `).
151+
152+ :param warg: arguments to be passed to the widget type.
153+
154+ :param callback: function taking the formatted data from with widget type.
155+ If the given widget type happens to be synchronous,
156+ ``nil `` will be passed to ``callback ``.
136157
137158.. _awesome : https://awesomewm.org/
138159.. _awful.widget.watch :
0 commit comments