Skip to content

Commit 901e03f

Browse files
committed
[docs] Move caching and security notes from README
1 parent be0eb48 commit 901e03f

File tree

5 files changed

+67
-66
lines changed

5 files changed

+67
-66
lines changed

README.md

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -466,71 +466,6 @@ vicious.register. Your function can accept `format` and `warg`
466466
arguments, just like workers.
467467

468468

469-
## <a name="power"></a>Power and Caching
470-
471-
When a lot of widgets are in use they, and awesome, can generate a lot
472-
of wake-ups and also be very expensive for system resources. This is
473-
especially important when running on battery power. It was a big
474-
problem with awesome v2 and widgets that used shell scripts to gather
475-
data, and with widget libraries written in languages like Ruby.
476-
477-
Lua is an extremely fast and efficient programming language, and
478-
Vicious takes advantage of that. But suspending Vicious widgets is one
479-
way to prevent them from draining your battery, despite that.
480-
481-
Update intervals also play a big role, and you can save a lot of power
482-
with a smart approach. Don't use intervals like: 5, 10, 30, 60, … to
483-
avoid harmonics. If you take the 60-second mark as an example, all of
484-
your widgets would be executed at that point. Instead think about
485-
using only prime numbers, in that case you will have only a few
486-
widgets executed at any given time interval. When choosing intervals
487-
also consider what a widget actually does. Some widget types read
488-
files that reside in memory, others call external utilities and some,
489-
like the mbox widget, read big files.
490-
491-
Vicious can also cache values returned by widget types. Caching
492-
enables you to have multiple widgets using the same widget type. With
493-
caching its worker function gets executed only once - which is also
494-
great for saving power.
495-
496-
* Some widget types keep internal data and if you call one multiple times
497-
without caching, the widget that executes it first would modify stored
498-
values. This can lead to problems and give you inconsistent data. Remember
499-
it for widget types like CPU and Network usage, which compare the old set of
500-
data with the new one to calculate current usage.
501-
502-
* Widget types that require a widget argument to be passed should be handled
503-
carefully. If you are requesting information for different devices then
504-
caching should not be used, because you could get inconsistent data.
505-
506-
507-
## Security
508-
509-
At the moment only one widget type (Gmail) requires auth. information
510-
in order to get to the data. In the future there could be more, and
511-
you should give some thought to the issue of protecting your data. The
512-
Gmail widget type by default stores login information in the ~/.netrc
513-
file, and you are advised to make sure that file is only readable by
514-
the owner. Other than that we can not force all users to conform to
515-
one standard, one way of keeping it secure, like in some keyring.
516-
517-
First let's clear why we simply don't encrypt the login information
518-
and store it in ciphertext. By exposing the algorithm anyone can
519-
reverse the encryption steps. Some claim even that's better than
520-
plaintext but it's just security trough obscurity.
521-
522-
Here are some ideas actually worth your time. Users that have KDE (or
523-
parts of it) installed could store their login information into the
524-
Kwallet service and request it via DBus from the widget type. It can
525-
be done with tools like `dbus-send` and `qdbus`. The Gnome keyring
526-
should support the same, so those with parts of Gnome installed could
527-
use that keyring.
528-
529-
Users of GnuPG (and its agent) could consider encrypting the netrc
530-
file with their GPG key. Trough the GPG Passphrase Agent they could
531-
then decrypt the file transparently while their session is active.
532-
533-
534469
## Usage examples
535470

536471
Start with a simple widget, like `date`. Then build your setup from

docs/source/caching.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.. _caching:
2+
3+
Power and Caching
4+
=================
5+
6+
When a lot of widgets are in use they, and awesome, can generate a lot
7+
of wake-ups and also be very expensive for system resources. This is
8+
especially important when running on battery power. It was a big problem
9+
with awesome v2 and widgets that used shell scripts to gather data,
10+
and with widget libraries written in languages like Ruby.
11+
12+
Lua is an extremely fast and efficient programming language, and Vicious
13+
takes advantage of that. But suspending Vicious widgets is one way
14+
to prevent them from draining your battery, despite that.
15+
16+
Update intervals also play a big role, and you can save a lot of power
17+
with a smart approach. Don't use intervals like: 5, 10, 30, 60, etc.
18+
to avoid harmonics. If you take the 60-second mark as an example,
19+
all of your widgets would be executed at that point. Instead think about
20+
using only prime numbers, in that case you will have only a few widgets
21+
executed at any given time interval. When choosing intervals also consider
22+
what a widget actually does. Some widget types read files that reside
23+
in memory, others call external utilities and some, like the mbox widget,
24+
read big files.
25+
26+
Vicious can also cache values returned by widget types. Caching enables you
27+
to have multiple widgets using the same widget type. With caching its worker
28+
function gets executed only once---which is also great for saving power.
29+
30+
* Some widget types keep internal data and if you call one multiple times
31+
without caching, the widget that executes it first would modify stored values.
32+
This can lead to problems and give you inconsistent data. Remember it
33+
for widget types like CPU and Network usage, which compare the old set
34+
of data with the new one to calculate current usage.
35+
* Widget types that require a widget argument to be passed should be
36+
handled carefully. If you are requesting information for different devices
37+
then caching should not be used, because you could get inconsistent data.

docs/source/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Table of Contents
2020

2121
usage-lua
2222
usage-awesome
23+
caching
24+
security
2325
copying
2426

2527
See Also

docs/source/security.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Security Notes
2+
==============
3+
4+
At the moment only one widget type (Gmail) requires
5+
authentication information in order to get to the data.
6+
In the future there could be more, and you should give some thought
7+
to the issue of protecting your data. The Gmail widget type by default
8+
stores login information in the ``~/.netrc`` file, and you are advised
9+
to make sure that file is only readable by the owner. Other than that
10+
we can not force all users to conform to one standard,
11+
one way of keeping it secure, like in some keyring.
12+
13+
First let's clear why we simply don't encrypt the login information
14+
and store it in ciphertext. By exposing the algorithm anyone can
15+
reverse the encryption steps. Some claim even that's better than
16+
plaintext but it's just security through obscurity.
17+
18+
Here are some ideas actually worth your time. Users that have KDE
19+
(or parts of it) installed could store their login information into
20+
the Kwallet service and request it via DBus from the widget type.
21+
It can be done with tools like ``dbus-send`` and ``qdbus``.
22+
The Gnome keyring should support the same, so those with parts of Gnome
23+
installed could use that keyring.
24+
25+
Users of GnuPG (and its agent) could consider encrypting the netrc file
26+
with their GPG key. Through the GPG Passphrase Agent they could then
27+
decrypt the file transparently while their session is active.

docs/source/usage-awesome.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Once you create a widget (a textbox, graph or a progressbar) call
4646

4747
``interval``
4848
Number of seconds between updates of the widget (default: 2).
49-
Read section [Power and Caching](#power) for more information.
49+
Read section :ref:`caching` for more information.
5050

5151
``warg``
5252
Arguments to be passed to widget types, e.g. the battery ID.

0 commit comments

Comments
 (0)