[theme] Add YAML as optional format for themes

This addresses issue #4
This commit is contained in:
Tobias Witek 2016-11-05 16:53:18 +01:00
parent 6eea8da1af
commit e2a6d41389
2 changed files with 68 additions and 2 deletions

View file

@ -1,5 +1,6 @@
import os
import json
import yaml
import glob
def getpath():
@ -12,6 +13,11 @@ def themes():
class Theme:
def __init__(self, config):
self._config = config
if os.path.isfile("{}/{}.yaml".format(getpath(), config.theme())):
with open("{}/{}.yaml".format(getpath(), config.theme())) as f:
self._data = yaml.load(f)
else:
with open("{}/{}.json".format(getpath(), config.theme())) as f:
self._data = json.load(f)
self._defaults = self._data.get("defaults", {})

View file

@ -0,0 +1,60 @@
defaults:
prefix: " "
suffix: " "
urgent: true
fg: "#aabbcc"
date:
prefix: " "
time:
prefix: " "
memory:
prefix: " ram "
cpu:
prefix: " cpu "
disk:
prefix: " hdd "
dnf:
prefix: " dnf "
pasink:
states:
muted:
prefix: " audio(mute) "
unmuted:
prefix: " audio "
pasource:
states:
muted:
prefix: " mic(mute) "
unmuted:
prefix: " mic "
nic:
states:
"wireless-up":
prefix: " wifi "
"wireless-down":
prefix: " wifi "
"wired-up":
prefix: " lan "
"wired-down":
prefix: " lan "
"tunnel-up":
prefix: " tun "
"tunnel-down":
prefix: " tun "
battery:
states:
charged:
suffix: " full "
charging:
suffix: " chr "
discharging_critical:
prefix: " ! "
suffix: " dis "
discharging_low:
suffix: " dis "
discharging_medium:
suffix: " dis "
discharging_high:
suffix: " dis "
discharging_full:
suffix: " dis "