summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/defaults/alot.rc.spec6
-rw-r--r--alot/settings.py17
2 files changed, 23 insertions, 0 deletions
diff --git a/alot/defaults/alot.rc.spec b/alot/defaults/alot.rc.spec
index 3d277437..296d58f0 100644
--- a/alot/defaults/alot.rc.spec
+++ b/alot/defaults/alot.rc.spec
@@ -16,6 +16,12 @@ tabwidth = integer(default=8)
# It will be used if you give `compose --template` a filename without a path prefix.
template_dir = string(default='$XDG_CONFIG_HOME/alot/templates')
+# directory containing theme files
+themes_dir = string(default=None)
+
+# name of the theme to use
+theme = string(default=None)
+
# fill threadline with message content
display_content_in_threadline = boolean(default=False)
diff --git a/alot/settings.py b/alot/settings.py
index 919915b0..b95595d7 100644
--- a/alot/settings.py
+++ b/alot/settings.py
@@ -162,6 +162,23 @@ class SettingsManager(object):
newbindings = newconfig['bindings']
if isinstance(newbindings, Section):
self._bindings.merge(newbindings)
+ # themes
+ themestring = newconfig['theme']
+ themes_dir = self._config.get('themes_dir')
+ if themes_dir:
+ themes_dir = os.path.expanduser(themes_dir)
+ else:
+ themes_dir = os.path.join(os.environ.get('XDG_CONFIG_HOME',
+ os.path.expanduser('~/.config')), 'alot', 'themes')
+ logging.debug(themes_dir)
+
+ if themestring:
+ if not os.path.isdir(themes_dir):
+ err_msg = 'cannot find theme %s: themes_dir %s is missing'
+ raise ConfigError(err_msg % (themestring, themes_dir))
+ else:
+ theme_path = os.path.join(themes_dir, themestring)
+ self._theme = Theme(theme_path)
self._accounts = self._parse_accounts(self._config)
self._accountmap = self._account_table(self._accounts)