Dotfiles/desktopenvs/hyprdrive/station-bar/paths.py

23 lines
753 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 live under XDG_STATE_HOME, NOT ~/.config — config-updater does
# `rm -rf ~/.config/station-bar` on every dotfiles sync (see orbit-menu/
# horizon-dock/astro-menu's paths.py for the same rationale), which would wipe
# a hand-edited config on the spot.
STATE_DIR = Path(os.environ.get("XDG_STATE_HOME", Path.home() / ".local" / "state")) / "station-bar"
CONFIG_FILE = STATE_DIR / "config.json"
APP_ID = "eu.abdelbaki.stationbar"
def ensure_dirs() -> None:
STATE_DIR.mkdir(parents=True, exist_ok=True)