Skip to content

Commit f5f1235

Browse files
authored
Merge pull request #1312 from pimutils/develop/plugins
basic plugin handling
2 parents b38de18 + 59ca5fb commit f5f1235

File tree

11 files changed

+805
-636
lines changed

11 files changed

+805
-636
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ not released yet
3131
status of an event with a symbol (e.g. `` for accepted, `` for declined,
3232
`?` for tentative); partication status is shown for the email addresses
3333
configured for the event's calendar
34+
* NEW support for color theme, command, and formatter plugins
3435

3536
0.11.2
3637
======

doc/source/hacking.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,36 @@ Before we will accept your PR, we will ask you to:
3131
* make sure your patch conforms with :pep:`008` (should be covered by passing
3232
tests)
3333

34+
Plugins
35+
-------
36+
37+
Khal now supports plugins, currently for supporting new commands (`example
38+
command plugin`_), formatting (`example formatting plugin`), and
39+
colors (`example color plugin`).
40+
41+
If you want to develop a new feature, please check if it can be implemented as
42+
a plugin. If you are unsure, please ask us, we will gladly help you and, if
43+
needed, also extend the plugin API. We would like to see new functionality
44+
matured in plugins before we consider integrating it into khal's core.
45+
46+
.. _`example command plugin`: https://github.com/geier/khal_navigate
47+
.. _`example formatting plugin`: https://github.com/tcuthbert/khal/tree/plugin/example
48+
.. _`example color plugin`: https://github.com/geier/khal_gruvbox/tree/importlib
49+
50+
51+
Color scheme plugins
52+
*********************
53+
54+
Khal color schemes plugins are only availlable for the `ikhal` interface. They
55+
are installed as python packages (e.g. `python -m pip install khal_gruvbox`).
56+
A color scheme plugin must provide an entry point `khal_colorscheme` and contain
57+
an urwid palette definition. The palette definition is a list of tuples, where
58+
each tuple contains an attribute name and a color definition. See the `urwid
59+
documentation`_ for more information. All currently avaialable attributes can be
60+
found in `khal's source code`_.
61+
62+
.. _`urwid documentation`: http://urwid.org/manual/displayattributes.html
63+
.. _`khal's source code`: https://github.com/pimutils/khal/blob/master/khal/ui/colors.py
3464

3565
General notes for developing khal (and lots of other python packages)
3666
---------------------------------------------------------------------

khal/_compat.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
__all__ = ["importlib_metadata"]
2+
3+
import sys
4+
5+
if sys.version_info >= (3, 10): # pragma: no cover
6+
from importlib import metadata as importlib_metadata
7+
else: # pragma: no cover
8+
import importlib_metadata

0 commit comments

Comments
 (0)