#!/usr/bin/python3
"""Re-apply the display mode/scale chosen in Settings at session start."""
import json, subprocess
from pathlib import Path
try:
    d = json.loads((Path.home() / ".config/mood/settings.json").read_text()).get("display") or {}
except Exception:
    d = {}
if d.get("output"):
    cmd = ["wlr-randr", "--output", d["output"]]
    if d.get("mode"):
        cmd += ["--mode", d["mode"]]
    if d.get("scale"):
        cmd += ["--scale", str(d["scale"])]
    subprocess.run(cmd, timeout=10)
