diff --git a/bumblebee/theme.py b/bumblebee/theme.py index 78d5f34..58c154e 100644 --- a/bumblebee/theme.py +++ b/bumblebee/theme.py @@ -1,13 +1,16 @@ import os import json +def getpath(): + return os.path.dirname("{}/themes/".format(os.path.dirname(os.path.realpath(__file__)))) + class Theme: _cycle_index = 0 _cycle = None def __init__(self, name="default"): self._data = None path = os.path.dirname(os.path.realpath(__file__)) - with open("{}/themes/{}.json".format(path, name)) as f: + with open("{}/{}.json".format(getpath(), name)) as f: self._data = json.load(f) self._defaults = self._data.get("defaults", {}) self._cycle = self._defaults.get("cycle", []) diff --git a/i3bumblebee b/i3bumblebee index 1545208..cfd59fa 100755 --- a/i3bumblebee +++ b/i3bumblebee @@ -3,6 +3,7 @@ import os import sys import time +import glob import pkgutil import argparse import textwrap @@ -25,7 +26,16 @@ def print_module_list(): print textwrap.fill("Description: {}".format(desc), 80, initial_indent=" ", subsequent_indent=" ") print textwrap.fill("Usage : {}".format(usage), 80, initial_indent=" ", subsequent_indent=" ") print textwrap.fill("Notes : {}".format(notes), 80, initial_indent=" ", subsequent_indent=" ") - print "\n" + print "" + +def print_theme_list(): + d = bumblebee.theme.getpath() + + print "available themes:" + print textwrap.fill(", ".join( + [ os.path.basename(f).replace(".json", "") for f in glob.iglob("{}/*.json".format(d)) ]), + 80, initial_indent = " ", subsequent_indent = " " + ) def main(): parser = argparse.ArgumentParser(description="display system data in the i3bar") @@ -42,6 +52,7 @@ def main(): if args.list: print_module_list() + print_theme_list() sys.exit(0) modules = []