"""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" # GApplication single-instance id (our own process). NOT the freedesktop # notification name — that well-known name (org.freedesktop.Notifications) is # owned separately in main.py, the same one dunst used to hold. APP_ID = "eu.abdelbaki.mnotifd" FDN_NAME = "org.freedesktop.Notifications" FDN_PATH = "/org/freedesktop/Notifications" FDN_IFACE = "org.freedesktop.Notifications" # Custom interfaces colocated at FDN_PATH, same well-known bus name — mirrors # dunst parking org.dunstproject.cmd0 alongside its own freedesktop interface # rather than using a bespoke object path. HISTORY_IFACE = "eu.abdelbaki.mnotifd.History1" CONTROLS_IFACE = "eu.abdelbaki.mnotifd.Controls1" # Notification history persists under XDG_CACHE_HOME, like the layouts # registry's ~/.cache/astro-menu/layouts.json — NOT ~/.config/mnotifd, which # config-updater wipes and re-copies on every dotfiles sync. CACHE_DIR = Path(os.environ.get("XDG_CACHE_HOME", Path.home() / ".cache")) / "mnotifd" HISTORY_FILE = CACHE_DIR / "history.json" # User settings live under XDG_STATE_HOME, same rationale/convention as # station-bar/paths.py (config-updater's rm -rf would wipe a hand-edited # ~/.config/mnotifd/config.json otherwise). STATE_DIR = Path(os.environ.get("XDG_STATE_HOME", Path.home() / ".local" / "state")) / "mnotifd" CONFIG_FILE = STATE_DIR / "config.json" def ensure_dirs() -> None: CACHE_DIR.mkdir(parents=True, exist_ok=True) STATE_DIR.mkdir(parents=True, exist_ok=True)