"""Tiny user-editable config file: ~/.local/state/horizon-dock/config.json. Read once at startup (main.py); flags are passed into HorizonDock's constructor rather than polled, so a change takes effect on the next horizon-dock-start.sh restart, not live. Same pattern as orbit-menu/config.py. """ from __future__ import annotations import json from paths import CONFIG_FILE, ensure_dirs # "tray": still undecided whether the full StatusNotifierItem satellite earns its # keep vs a simpler dock — default on, but easy to switch off without touching code. # "hologram": same toggle orbit-menu/astro-menu expose for their own overlay. _DEFAULTS = {"tray": True, "hologram": True} def _load() -> dict: try: data = json.loads(CONFIG_FILE.read_text()) except (FileNotFoundError, json.JSONDecodeError): data = {} merged = {**_DEFAULTS, **data} if not CONFIG_FILE.exists(): ensure_dirs() CONFIG_FILE.write_text(json.dumps(merged, indent=2) + "\n") return merged def tray_enabled() -> bool: return bool(_load().get("tray", True)) def hologram_enabled() -> bool: return bool(_load().get("hologram", True))