summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--monitor_menu/__main__.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/monitor_menu/__main__.py b/monitor_menu/__main__.py
index e42c440..fce1a65 100644
--- a/monitor_menu/__main__.py
+++ b/monitor_menu/__main__.py
@@ -8,6 +8,7 @@ import logging
from os.path import expanduser
import subprocess
from typing import Any
+import yaml
import dialog
@@ -161,9 +162,13 @@ def main():
args = parser.parse_args()
logging.basicConfig(level=args.log_level.numerical_level)
- config_file = '~/.config/monitor-profiles.json'
- with open(expanduser(config_file)) as fh:
- data = json.load(fh)
+ try:
+ with open(expanduser("~/.config/monitor-profiles.yaml")) as fh:
+ data = yaml.safe_load(fh)
+ except FileNotFoundError:
+ with open(expanduser("~/.config/monitor-profiles.json")) as fh:
+ data = json.load(fh)
+
profiles = [Profile.from_json_dict(item) for item in data]
match args.command: