| 1 |
.. _custom-wtype: |
| 2 |
|
| 3 |
Custom Widget Types |
| 4 |
=================== |
| 5 |
|
| 6 |
Use any of the existing widget types as a starting point for your own. |
| 7 |
Write a quick worker function that does the work and plug it in. |
| 8 |
How data will be formatted, will it be red or blue, should be |
| 9 |
defined in ``rc.lua`` (or somewhere else, outside the actual module). |
| 10 |
|
| 11 |
Before writing a widget type you should check if there is already one |
| 12 |
in the contrib directory of Vicious. The contrib directory contains |
| 13 |
extra widgets you can use. Some are for less common hardware, and others |
| 14 |
were contributed by Vicious users. Most of the contrib widgets are obsolete. |
| 15 |
Contrib widgets will not be imported by init unless you explicitly enable it, |
| 16 |
or load them in your ``rc.lua``. |
| 17 |
|
| 18 |
Some users would like to avoid writing new modules. For them Vicious kept |
| 19 |
the old Wicked functionality, possibility to register their own functions |
| 20 |
as widget types. By providing them as the second argument to |
| 21 |
:lua:func:`vicious.register`. Your function can accept ``format`` and ``warg`` |
| 22 |
arguments, just like workers. |