From: 
Subject: Debian changes

The Debian packaging of linux-voice-assistant is maintained in git, using a workflow
similar to the one described in dgit-maint-merge(7).
The Debian delta is represented by this one combined patch; there isn't a
patch queue that can be represented as a quilt series.

A detailed breakdown of the changes is available from their canonical
representation -- git commits in the packaging repository.
For example, to see the changes made by the Debian maintainer in the first
upload of upstream version 1.2.3, you could use:

    % git clone https://git.dgit.debian.org/linux-voice-assistant
    % cd linux-voice-assistant
    % git log --oneline 1.2.3..debian/1.2.3-1 -- . ':!debian'

(If you have dgit, use `dgit clone linux-voice-assistant`, rather than plain `git clone`.)

We don't use debian/source/options single-debian-patch because it has bugs.
Therefore, NMUs etc. may nevertheless have made additional patches.

---

diff --git a/linux_voice_assistant/__main__.py b/linux_voice_assistant/__main__.py
index bb86eb3..d4e9425 100644
--- a/linux_voice_assistant/__main__.py
+++ b/linux_voice_assistant/__main__.py
@@ -39,8 +39,32 @@ _LOG_FORMAT = "%(asctime)s.%(msecs)03d %(levelname)s:%(name)s:%(message)s"
 _LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
 _MODULE_DIR = Path(__file__).parent
 _REPO_DIR = _MODULE_DIR.parent
-_WAKEWORDS_DIR = _REPO_DIR / "wakewords"
-_SOUNDS_DIR = _REPO_DIR / "sounds"
+_APP_NAME = "linux-voice-assistant"
+_SYSTEM_DATA_DIR = Path("/usr/share") / _APP_NAME
+
+
+def _xdg_path(env_var: str, default_relative: Path, app_name: str) -> Path:
+    """Return an XDG base directory path for writable application state."""
+    base_dir = Path.home() / default_relative
+    if env_value := os.environ.get(env_var):
+        base_dir = Path(env_value).expanduser()
+
+    return base_dir / app_name
+
+
+def _asset_dir(name: str) -> Path:
+    for base_dir in (_REPO_DIR, _SYSTEM_DATA_DIR):
+        asset_dir = base_dir / name
+        if asset_dir.exists():
+            return asset_dir
+
+    return _REPO_DIR / name
+
+
+_WAKEWORDS_DIR = _asset_dir("wakewords")
+_SOUNDS_DIR = _asset_dir("sounds")
+_DEFAULT_DOWNLOAD_DIR = _xdg_path("XDG_DATA_HOME", Path(".local/share"), _APP_NAME)
+_DEFAULT_PREFERENCES_FILE = _xdg_path("XDG_CONFIG_HOME", Path(".config"), _APP_NAME) / "preferences.json"
 
 
 # -----------------------------------------------------------------------------
@@ -108,7 +132,7 @@ async def main() -> None:
     )
     parser.add_argument(
         "--download-dir",
-        default=_REPO_DIR / "local",
+        default=_DEFAULT_DOWNLOAD_DIR,
         help="Directory to download custom wake word models to",
     )
     parser.add_argument(
@@ -175,8 +199,8 @@ async def main() -> None:
     )
     parser.add_argument(
         "--preferences-file",
-        default=_REPO_DIR / "preferences.json",
-        help="Directory and file name for the preferences JSON file",
+        default=_DEFAULT_PREFERENCES_FILE,
+        help="Directory and file name for the file where the preferences are stored in JSON format",
     )
     parser.add_argument(
         "--host",
