[main] Add available themes to listing output
This commit is contained in:
parent
c0421163d4
commit
f02c49286b
2 changed files with 16 additions and 2 deletions
|
@ -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", [])
|
||||
|
|
13
i3bumblebee
13
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 = []
|
||||
|
|
Loading…
Reference in a new issue