diff options
author | Von Random <von@vdrandom.org> | 2019-03-05 12:33:05 +0300 |
---|---|---|
committer | Von Random <von@vdrandom.org> | 2019-03-05 12:33:05 +0300 |
commit | 46f3d778aff5400c3ce3c3aecaf8ffaea19a6ede (patch) | |
tree | a13f8a12564a993b1a04359f4dbb04c6be7f1324 | |
parent | ba862efad9eef3064459d0ccb4e159dc9bb62c32 (diff) |
move config to yaml, json is atrocious
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | conf.json | 38 | ||||
-rw-r--r-- | conf.yaml | 20 | ||||
-rwxr-xr-x | vdstatus | 12 |
4 files changed, 35 insertions, 42 deletions
@@ -1,4 +1,9 @@ vdstatus ======== -A status script initially for i3bar. Potentially will support lemonbar. It is on very early stages of development. +A simple replacement for i3status that is both extensible and customizable. +Documentation is pending, but no promises. + +Requirements: +* python 3 +* pyyaml diff --git a/conf.json b/conf.json deleted file mode 100644 index 9968068..0000000 --- a/conf.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "output_format": "i3", - "plugins": [ - { - "name": "ping", - "hosts": [ - "de-ber-as20647.anchors.atlas.ripe.net", - "nl-ams-as1101.anchors.atlas.ripe.net", - "uk-boh-as196745.anchors.atlas.ripe.net" - ], - "title": "NET" - }, - { - "name": "disk", - "partition": "/", - "problem": 80, - "hide_ok": false - }, - { - "name": "disk", - "partition": "/home", - "problem": 90 - }, - { - "name": "pacman" - }, - { - "name": "mem" - }, - { - "name": "load" - }, - { - "name": "date", - "format": "%a %d %H:%M" - } - ] -} diff --git a/conf.yaml b/conf.yaml new file mode 100644 index 0000000..7416c97 --- /dev/null +++ b/conf.yaml @@ -0,0 +1,20 @@ +output_format: i3 +plugins: +- name: ping + title: NET + hosts: + - de-ber-as20647.anchors.atlas.ripe.net + - nl-ams-as1101.anchors.atlas.ripe.net + - uk-boh-as196745.anchors.atlas.ripe.net +- name: disk + partition: / + problem: 80 + hide_ok: false +- name: disk + partition: /home + problem: 90 +- name: pacman +- name: mem +- name: load +- name: date + format: '%a %d %H:%M' @@ -1,4 +1,5 @@ #!/usr/bin/python3 +# pylint: disable=C0111 # TODO: consider per plugin hide_ok overriding global, not the other way around # TODO: add documentation / comments # TODO: interactivity support @@ -8,10 +9,11 @@ import json import os import sys import time +import yaml import plugins -DEFAULT_CONFIG = os.path.join(os.environ['HOME'], '.config/vdstatus/conf.json') +DEFAULT_CONFIG = os.path.join(os.environ['HOME'], '.config/vdstatus/conf.yaml') def parse_arguments(): @@ -33,7 +35,7 @@ class PluginRunner: } config = dict() with open(config_file) as config_data: - config = json.load(config_data) + config = yaml.load(config_data) self.conf = plugins.parse_config(config, defaults) self.plugins_loaded = list() self.format_output = self.format_term @@ -79,9 +81,13 @@ class PluginRunner: return ' \033[1m|\033[0m '.join(return_info) -if __name__ == '__main__': +def main(): args = parse_arguments() plugin_runner = PluginRunner(args.conf) plugin_runner.start() time.sleep(0.1) plugin_runner.run() + + +if __name__ == '__main__': + main() |