Dotfiles/desktopenvs/hyprdrive/horizon-dock/paths.py

24 lines
830 B
Python

"""Shared filesystem locations. Works whether run from the repo or ~/.config."""
from __future__ import annotations
import os
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent
STYLE_DIR = BASE_DIR / "style"
# User settings/favorites live under XDG_STATE_HOME, NOT ~/.config — config-updater
# does `rm -rf ~/.config/horizon-dock` on every dotfiles sync (see orbit-menu/
# paths.py and astal-menu/paths.py for the same rationale), which would wipe a
# hand-edited config or pinned favorites on the spot.
STATE_DIR = Path(os.environ.get("XDG_STATE_HOME", Path.home() / ".local" / "state")) / "horizon-dock"
CONFIG_FILE = STATE_DIR / "config.json"
FAVORITES_FILE = STATE_DIR / "favorites.json"
APP_ID = "eu.abdelbaki.horizondock"
def ensure_dirs() -> None:
STATE_DIR.mkdir(parents=True, exist_ok=True)