summaryrefslogtreecommitdiff
path: root/plugins/simple_notify.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-04-13 22:33:06 +0200
committermathieui <mathieui@mathieui.net>2013-04-13 22:33:06 +0200
commitd676c2ee7b6207ff0b2a7b384052ab07c08bf43a (patch)
treeb6c22d35da1eb5bc33ab0cc983a86d8dfe6c2a78 /plugins/simple_notify.py
parente6cb43eeedcd6c6961c5ab430f25bb962d40bf8e (diff)
downloadpoezio-d676c2ee7b6207ff0b2a7b384052ab07c08bf43a.tar.gz
poezio-d676c2ee7b6207ff0b2a7b384052ab07c08bf43a.tar.bz2
poezio-d676c2ee7b6207ff0b2a7b384052ab07c08bf43a.tar.xz
poezio-d676c2ee7b6207ff0b2a7b384052ab07c08bf43a.zip
Move the plugins documentation
(use automodule directive & docstrings)
Diffstat (limited to 'plugins/simple_notify.py')
-rw-r--r--plugins/simple_notify.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/plugins/simple_notify.py b/plugins/simple_notify.py
index 62b1f81a..a44a6902 100644
--- a/plugins/simple_notify.py
+++ b/plugins/simple_notify.py
@@ -1,3 +1,69 @@
+"""
+This plugin lets you execute a command, to notify you from new important
+messages.
+
+Installation and configuration
+------------------------------
+
+You need to create a plugin configuration file. Create a file named :file:`simple_notify.cfg`
+into your plugins configuration directory (:file:`~/.config/poezio/plugins` by
+default), and fill it like this:
+
+First example:
+
+.. code-block:: ini
+
+ [simple_notify]
+ command = notify-send -i /path/to/poezio/data/poezio_80.png "New message from %(from)s" "%(body)s"
+
+Second example:
+
+.. code-block:: ini
+
+ [simple_notify]
+ command = echo \\<%{from}s\\> %{body}s >> some.fifo
+ delay = 3
+ after_command = echo >> some.fifo
+
+You can put any command, instead of these ones. You can also use the
+special keywords ``%(from)s`` and ``%(body)s`` that will be replaced
+directly in the command line by the author of the message, and the body.
+
+The first example shown above will display something like this:
+
+.. figure:: ../images/simple_notify_example.png
+ :alt: Simple notify example
+
+The second example will first write the author and the message in a
+fifo, that fifo can locally be read by some other program (was tested
+with the xmobar PipeReader command, which displays what is read from a
+fifo into a status bar. Be careful, you have two different fifos in
+that case, don’t get confused). The :term:`delay` and :term:`after_command` options
+are used to erase/delete/kill the notification after a certain
+delay. In our example it is used to display an empty message in our
+xmobar, erasing the notification after 3 seconds.
+
+.. note:: If you set the :term:`exec_remote` option to ``true`` into the
+ main configuration file, the command will be executed remotely
+ (as explained in the :ref:`link-plugin` plugin help).
+
+Options defined
+---------------
+
+.. glossary::
+ :sorted:
+
+ command
+ The command to execute (with special keywords ``%{from}s`` and ``${body}s``)
+
+ delay
+ Delay after which :term:`after_command` must be executed.
+
+ after_command
+ Command to run after :term:`delay`. You probably want to clean up things.
+
+"""
+
from plugin import BasePlugin
from xhtml import clean_text, get_body_from_message_stanza
from timed_events import DelayedEvent