Skip to content

Commit 4ae9245

Browse files
committed
Update changelog and docs for vicious.call
1 parent 9df7237 commit 4ae9245

File tree

4 files changed

+46
-19
lines changed

4 files changed

+46
-19
lines changed

CHANGELOG.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
Changelog
22
=========
33

4-
Changes in 2.5.0 (WIP)
5-
----------------------
4+
Changes in 2.5.0
5+
----------------
6+
7+
Fixed:
8+
9+
- ``vicious.call`` freezing awesome when used with asynchronous widget types
10+
11+
Added:
12+
13+
- ``vicious.call_async`` asynchronous analogous to ``vicious.call``
614

715
Moved:
816

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Sphinx >= 3
2+
sphinx_rtd_theme
23
sphinxcontrib-luadomain

docs/source/conf.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@
2828
exclude_patterns = []
2929

3030
# Options for HTML output
31-
html_theme = 'alabaster'
32-
html_theme_options = {
33-
'github_user': 'vicious-widgets', 'github_repo': 'vicious',
34-
'github_button': True, 'github_count': False}
31+
html_theme = 'sphinx_rtd_theme'
3532
html_show_copyright = False
3633

3734
# Add any paths that contain custom static files (such as style sheets)

docs/source/usage-awesome.rst

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)