@@ -13,126 +13,6 @@ Lua libraries, but may depend on additional system utilities (see widget
1313description).
1414
1515
16- ## Usage
17-
18- When provided by an operating system package, or installed from source
19- into the Lua library path Vicious, can be used as a regular Lua
20- library, to be used stand-alone or to feed widgets of any window
21- manager (e.g. Ion, WMII). It is compatible with Lua version 5.1 and above.
22-
23- ``` lua
24- > widgets = require (" vicious.widgets.init" )
25- > print (widgets .volume (nil , " Master" )[1 ])
26- 100
27- ```
28-
29-
30- ## Usage within Awesome
31-
32- To use Vicious with Awesome, install the package from your operating
33- system provider, or download the source code and move it to your
34- awesome configuration directory in ` $XDG_CONFIG_HOME ` (usually ` ~/.config ` ):
35-
36- ``` bash
37- $ git clone https://github.com/vicious-widgets/vicious.git
38- $ mv vicious $XDG_CONFIG_HOME /awesome/
39- ```
40-
41- Vicious will only load modules for widget types you intend to use in
42- your awesome configuration, to avoid having useless modules sitting in
43- your memory.
44-
45- Then add the following to the top of your ` rc.lua ` :
46-
47- ``` lua
48- local vicious = require (" vicious" )
49- ```
50-
51- ### Register a widget
52-
53- Once you create a widget (a textbox, graph or a progressbar) call
54- ` vicious.register() ` to register it with Vicious:
55-
56- vicious.register(widget, wtype, format, interval, warg)
57-
58- #### widget
59-
60- * Awesome* widget created with ` widget() ` or ` awful.widget() ` (in case of a
61- graph or a progressbar).
62-
63- #### wtype
64-
65- Type: Vicious widget or ` function ` :
66-
67- * Vicious widget type: any of the available (default, or custom)
68- [ widget type provided by Vicious] ( #widgets ) .
69- * function: custom function from your own * Awesome* configuration can be
70- registered as widget types (see [ Custom widget types] ( #custom-widget ) ).
71-
72- #### format
73-
74- Type: ` string ` or ` function ` :
75-
76- * string: ` $key ` will be replaced by respective value in the table ` t ` returned
77- by the widget type. I.e. use ` $1 ` , ` $2 ` , etc. to retrieve data from an
78- integer-indexed table (a.k.a. array); ` ${foo bar} ` will be substituted by
79- ` t["{foo bar}"] ` .
80- * ` function (widget, args) ` can be used to manipulate data returned by the
81- widget type (see [ Format functions] ( #format-func ) ).
82-
83- #### interval
84-
85- Number of seconds between updates of the widget (default: 2). Read section
86- [ Power and Caching] ( #power ) for more information.
87-
88- #### warg
89-
90- Some widget types require an argument to be passed, for example the battery ID.
91-
92- ` vicious.register ` alone is not much different from
93- [ awful.widget.watch] ( https://awesomewm.org/doc/api/classes/awful.widget.watch.html ) ,
94- which has been added to Awesome since version 4.0. However, Vicious offers more
95- advanced control of widgets' behavior by providing the following functions.
96-
97- ### Unregister a widget
98-
99- vicious.unregister(widget, keep)
100-
101- If ` keep == true ` , ` widget ` will be suspended and wait for activation.
102-
103- ### Suspend all widgets
104-
105- vicious.suspend()
106-
107- See [ example automation script] ( http://sysphere.org/~anrxc/local/sources/lmt-vicious.sh )
108- for the "laptop-mode-tools" start-stop module.
109-
110- ### Restart suspended widgets
111-
112- vicious.activate(widget)
113-
114- If ` widget ` is provided only that widget will be activated.
115-
116- ### Enable caching of a widget type
117-
118- vicious.cache(wtype)
119-
120- Enable caching of values returned by a widget type.
121-
122- ### Force update of widgets
123-
124- vicious.force(wtable)
125-
126- ` wtable ` is a table of one or more widgets to be updated.
127-
128- ### Get data from a widget
129-
130- vicious.call(wtype, format, warg)
131-
132- Fetch data from ` wtype ` to use it outside from the wibox
133- ([ example] ( #call-example ) ).
134-
135-
13616## <a name =" widgets " ></a >Widget types
13717
13818Widget types consist of worker functions that take two arguments ` format ` and
0 commit comments