Skip to content

Commit 7701418

Browse files
committed
[docs] Employ sphinxcontrib.luadomain
1 parent 1840d0b commit 7701418

File tree

4 files changed

+89
-61
lines changed

4 files changed

+89
-61
lines changed

docs/requirements.txt

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

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Add any Sphinx extension module names here, as strings.
1717
# They can be extensions coming with Sphinx (named 'sphinx.ext.*')
1818
# or your custom ones.
19-
extensions = ['sphinx.ext.extlinks']
19+
extensions = ['sphinx.ext.extlinks', 'sphinxcontrib.luadomain']
2020
extlinks = {'github': ('https://github.com/%s', '@')}
2121

2222
# Add any paths that contain templates here, relative to this directory.

docs/source/usage-awesome.rst

Lines changed: 81 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Usage within Awesome
22
====================
33

4-
To use Vicious with Awesome, install the package from your operating system
4+
To use Vicious with awesome_, install the package from your operating system
55
provider, or download the source code and move it to your awesome
66
configuration directory in ``$XDG_CONFIG_HOME`` (usually ``~/.config``)::
77

@@ -18,99 +18,123 @@ Then add the following to the top of your ``rc.lua``:
1818
1919
local vicious = require("vicious")
2020
21-
Register a Widget
22-
-----------------
21+
vicious.register
22+
----------------
2323

24-
Once you create a widget (a textbox, graph or a progressbar) call
25-
``vicious.register()`` to register it with Vicious::
24+
Once you create a widget (a textbox, graph or a progressbar),
25+
call ``vicious.register`` to register it with Vicious:
2626

27-
vicious.register(widget, wtype, format, interval, warg)
27+
.. lua:function:: vicious.register(widget, wtype, format, interval, warg)
2828
29-
``widget``
30-
Awesome_ widget created with ``widget()`` or ``awful.widget()``
31-
(in case of a graph or a progressbar).
29+
Register a widget.
3230

33-
``wtype`` of type Vicious widget or ``function``
34-
* Vicious widget type: any of the available (default, or custom)
35-
[widget type provided by Vicious](#widgets).
36-
* function: custom function from your own *Awesome* configuration can be
37-
registered as widget types (see [Custom widget types](#custom-widget)).
31+
:param widget: awesome widget created from
32+
``awful.widget`` or ``wibox.widget``
3833

39-
``format`` of type ``string`` or ``function``
40-
* string: ``$key`` will be replaced by respective value in the table ``t``
41-
returned by the widget type. I.e. use ``$1``, ``$2``, etc. to retrieve data
42-
from an integer-indexed table (a.k.a. array); ``${foo bar}`` will be
43-
substituted by ``t["{foo bar}"]``.
44-
* ``function (widget, args)`` can be used to manipulate data returned by the
45-
widget type (see [Format functions](#format-func)).
34+
:param wtype:
35+
either of
4636

47-
``interval``
48-
Number of seconds between updates of the widget (default: 2).
49-
Read section :ref:`caching` for more information.
37+
* Vicious widget type: any widget type
38+
:ref:`provided by Vicious <widgets>` or customly defined.
39+
* ``function``: custom function from your own
40+
awesome configuration can be registered as widget types
41+
(see [Custom widget types](#custom-widget)).
5042

51-
``warg``
52-
Arguments to be passed to widget types, e.g. the battery ID.
43+
:param format:
44+
either of
45+
46+
* string: ``$key`` will be replaced by respective value in the table
47+
``t`` returned by the widget type, i.e. use ``$1``, ``$2``, etc.
48+
to retrieve data from an integer-indexed table (a.k.a. array);
49+
``${foo bar}`` will be substituted by ``t["{foo bar}"]``.
50+
* ``function (widget, args)`` can be used to manipulate data returned
51+
by the widget type (see [Format functions](#format-func)).
52+
53+
:param interval: number of seconds between updates of the widget
54+
(default: 2). See :ref:`caching` for more information.
55+
56+
:param warg: arguments to be passed to widget types, e.g. the battery ID.
5357

5458
``vicious.register`` alone is not much different from awful.widget.watch_,
5559
which has been added to Awesome since version 4.0. However, Vicious offers
5660
more advanced control of widgets' behavior by providing the following functions.
5761

58-
Unregister a Widget
59-
-------------------
62+
vicious.unregister
63+
------------------
6064

61-
::
65+
.. lua:function:: vicious.unregister(widget, keep)
6266
63-
vicious.unregister(widget, keep)
67+
Unregister a widget.
6468

65-
If ``keep == true``, ``widget`` will be suspended and wait for activation.
69+
:param widget: awesome widget created from
70+
``awful.widget`` or ``wibox.widget``
71+
:param keep: if true suspend ``widget`` and wait for activation
72+
:type keep: bool
6673

67-
Suspend All Widgets
68-
-------------------
74+
vicious.suspend
75+
---------------
6976

70-
::
77+
.. lua:function:: vicious.suspend()
7178
72-
vicious.suspend()
79+
Suspend all widgets.
7380

7481
See `example automation script`_ for the "laptop-mode-tools" start-stop module.
7582

76-
Restart Suspended Widgets
77-
-------------------------
83+
vicious.activate
84+
----------------
85+
86+
.. lua:function:: vicious.activate([widget])
87+
88+
Restart suspended widget(s).
89+
90+
:param widget: if provided only that widget will be activated
7891

79-
::
92+
vicious.cache
93+
-------------
8094

81-
vicious.activate(widget)
95+
.. lua:function:: vicious.cache(wtype)
8296
83-
If ``widget`` is provided only that widget will be activated.
97+
Enable caching of values returned by a widget type.
8498

85-
Enable Caching of a Widget Type
86-
-------------------------------
99+
vicious.force
100+
--------------
87101

88-
::
102+
.. lua:function:: vicious.force(wtable)
89103
90-
vicious.cache(wtype)
104+
Force update of given widgets.
91105

92-
Enable caching of values returned by a widget type.
106+
:param wtable: table of one or more widgets to be updated
93107

94-
Force update of widgets
95-
-----------------------
108+
vicious.call
109+
------------
96110

97-
::
111+
.. lua:function:: vicious.call(wtype, format, warg)
98112
99-
vicious.force(wtable)
113+
Fetch data from the widget type to use it outside of the widget
114+
([example](#call-example)).
100115

101-
where ``wtable`` is a table of one or more widgets to be updated.
116+
:param wtype:
117+
either of
102118

103-
Get Data from a Widget
104-
----------------------
119+
* Vicious widget type: any widget type
120+
:ref:`provided by Vicious <widgets>` or customly defined.
121+
* ``function``: custom function from your own
122+
awesome configuration can be registered as widget types
123+
(see [Custom widget types](#custom-widget)).
105124

106-
::
125+
:param format:
126+
either of
107127

108-
vicious.call(wtype, format, warg)
128+
* string: ``$key`` will be replaced by respective value in the table
129+
``t`` returned by the widget type, i.e. use ``$1``, ``$2``, etc.
130+
to retrieve data from an integer-indexed table (a.k.a. array);
131+
``${foo bar}`` will be substituted by ``t["{foo bar}"]``.
132+
* ``function (widget, args)`` can be used to manipulate data returned
133+
by the widget type (see [Format functions](#format-func)).
109134

110-
Fetch data from ``wtype`` to use it outside from the wibox
111-
([example](#call-example)).
135+
:param warg: arguments to be passed to widget types, e.g. the battery ID.
112136

113-
.. _Awesome: https://awesomewm.org/
137+
.. _awesome: https://awesomewm.org/
114138
.. _awful.widget.watch:
115139
https://awesomewm.org/doc/api/classes/awful.widget.watch.html
116140
.. _example automation script:

docs/source/widgets.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
.. _widgets:
2+
13
Officially Supported Widget Types
24
=================================
35

4-
Widget types consist of worker functions that take two arguments ``format`` and
5-
``warg`` (in that order), which were previously passed to ``vicious.register``,
6-
and return a table of values to be formatted by ``format``.
6+
Widget types consist of worker functions that take two arguments
7+
``format`` and ``warg`` (in that order), which were previously
8+
passed to :lua:func:`vicious.register`, and return a table of values
9+
to be formatted by ``format``.
710

811
vicious.widgets.bat
912
-------------------

0 commit comments

Comments
 (0)