Skip to content

Commit

Permalink
[docs] Move custom widget type guide from README
Browse files Browse the repository at this point in the history
  • Loading branch information
McSinyx committed Sep 21, 2020
1 parent 7701418 commit 5f87644
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
21 changes: 0 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,6 @@ Lua libraries, but may depend on additional system utilities (see widget
description).


## <a name="custom-widget"></a>Custom widget types

Use any of the existing widget types as a starting point for your
own. Write a quick worker function that does the work and plug it
in. How data will be formatted, will it be red or blue, should be
defined in rc.lua (or somewhere else, outside the actual module).

Before writing a widget type you should check if there is already one in the
contrib directory of Vicious. The contrib directory contains extra widgets you
can use. Some are for less common hardware, and other were contributed by
Vicious users. Most of the contrib widgets are obsolete. Contrib widgets will
not be imported by init unless you explicitly enable it, or load them in your
rc.lua.

Some users would like to avoid writing new modules. For them Vicious
kept the old Wicked functionality, possibility to register their own
functions as widget types. By providing them as the second argument to
vicious.register. Your function can accept `format` and `warg`
arguments, just like workers.


## Usage examples

Start with a simple widget, like `date`. Then build your setup from
Expand Down
22 changes: 22 additions & 0 deletions docs/source/custom.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. _custom-wtype:

Custom Widget Types
===================

Use any of the existing widget types as a starting point for your own.
Write a quick worker function that does the work and plug it in.
How data will be formatted, will it be red or blue, should be
defined in ``rc.lua`` (or somewhere else, outside the actual module).

Before writing a widget type you should check if there is already one
in the contrib directory of Vicious. The contrib directory contains
extra widgets you can use. Some are for less common hardware, and others
were contributed by Vicious users. Most of the contrib widgets are obsolete.
Contrib widgets will not be imported by init unless you explicitly enable it,
or load them in your ``rc.lua``.

Some users would like to avoid writing new modules. For them Vicious kept
the old Wicked functionality, possibility to register their own functions
as widget types. By providing them as the second argument to
:lua:func:`vicious.register`. Your function can accept ``format`` and ``warg``
arguments, just like workers.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Table of Contents
usage-lua
usage-awesome
widgets
custom
caching
security
copying
Expand Down
4 changes: 2 additions & 2 deletions docs/source/usage-awesome.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ call ``vicious.register`` to register it with Vicious:
:ref:`provided by Vicious <widgets>` or customly defined.
* ``function``: custom function from your own
awesome configuration can be registered as widget types
(see [Custom widget types](#custom-widget)).
(see :ref:`custom-wtype`).

:param format:
either of
Expand Down Expand Up @@ -120,7 +120,7 @@ vicious.call
:ref:`provided by Vicious <widgets>` or customly defined.
* ``function``: custom function from your own
awesome configuration can be registered as widget types
(see [Custom widget types](#custom-widget)).
(see :ref:`custom-wtype`).

:param format:
either of
Expand Down

0 comments on commit 5f87644

Please sign in to comment.