From da3efe9e5d187da73a081e88e8ee0afaab64d1fc Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Mon, 22 Jun 2026 15:32:02 -0700 Subject: [PATCH 1/3] fix(snap): use snap-owned XDG directories Signed-off-by: Piotr Mlocek --- python/openshell/release_formula_test.py | 9 +++++++++ snapcraft.yaml | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/python/openshell/release_formula_test.py b/python/openshell/release_formula_test.py index b3ab871ae..9e6d5ee40 100644 --- a/python/openshell/release_formula_test.py +++ b/python/openshell/release_formula_test.py @@ -113,6 +113,15 @@ def test_snap_wrapper_uses_optional_gateway_config_without_generating_toml() -> assert 'exec "${SNAP}/bin/openshell-gateway" "$@"' in wrapper +def test_snap_cli_uses_snap_owned_xdg_dirs() -> None: + repo_root = Path(__file__).resolve().parents[2] + snapcraft = (repo_root / "snapcraft.yaml").read_text(encoding="utf-8") + + assert snapcraft.count('XDG_CONFIG_HOME: "$SNAP_USER_COMMON/.config"') == 2 + assert snapcraft.count('XDG_DATA_HOME: "$SNAP_USER_COMMON/.local/share"') == 2 + assert snapcraft.count('XDG_STATE_HOME: "$SNAP_USER_COMMON/.local/state"') == 2 + + def test_rpm_spec_uses_gateway_defaults_without_config_helper() -> None: repo_root = Path(__file__).resolve().parents[2] spec = (repo_root / "openshell.spec").read_text(encoding="utf-8") diff --git a/snapcraft.yaml b/snapcraft.yaml index 01d90366e..f7354aa01 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -62,6 +62,10 @@ platforms: apps: openshell: command: bin/openshell + environment: + XDG_CONFIG_HOME: "$SNAP_USER_COMMON/.config" + XDG_DATA_HOME: "$SNAP_USER_COMMON/.local/share" + XDG_STATE_HOME: "$SNAP_USER_COMMON/.local/state" plugs: - home - network @@ -70,6 +74,10 @@ apps: term: command: bin/openshell term desktop: meta/gui/term.desktop + environment: + XDG_CONFIG_HOME: "$SNAP_USER_COMMON/.config" + XDG_DATA_HOME: "$SNAP_USER_COMMON/.local/share" + XDG_STATE_HOME: "$SNAP_USER_COMMON/.local/state" plugs: - home - network From b19077ab865ef37a23e877496d693ad46a458ba2 Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Tue, 23 Jun 2026 08:08:52 -0700 Subject: [PATCH 2/3] remove unneeded test --- python/openshell/release_formula_test.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/python/openshell/release_formula_test.py b/python/openshell/release_formula_test.py index 9e6d5ee40..b3ab871ae 100644 --- a/python/openshell/release_formula_test.py +++ b/python/openshell/release_formula_test.py @@ -113,15 +113,6 @@ def test_snap_wrapper_uses_optional_gateway_config_without_generating_toml() -> assert 'exec "${SNAP}/bin/openshell-gateway" "$@"' in wrapper -def test_snap_cli_uses_snap_owned_xdg_dirs() -> None: - repo_root = Path(__file__).resolve().parents[2] - snapcraft = (repo_root / "snapcraft.yaml").read_text(encoding="utf-8") - - assert snapcraft.count('XDG_CONFIG_HOME: "$SNAP_USER_COMMON/.config"') == 2 - assert snapcraft.count('XDG_DATA_HOME: "$SNAP_USER_COMMON/.local/share"') == 2 - assert snapcraft.count('XDG_STATE_HOME: "$SNAP_USER_COMMON/.local/state"') == 2 - - def test_rpm_spec_uses_gateway_defaults_without_config_helper() -> None: repo_root = Path(__file__).resolve().parents[2] spec = (repo_root / "openshell.spec").read_text(encoding="utf-8") From 4c3bf1a0e6116a5ecea8479d49c4df708ded71db Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Thu, 25 Jun 2026 11:29:23 -0700 Subject: [PATCH 3/3] docs(snap): document snap-owned CLI state Signed-off-by: Piotr Mlocek --- docs/about/installation.mdx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/about/installation.mdx b/docs/about/installation.mdx index 256015947..87c8a8363 100644 --- a/docs/about/installation.mdx +++ b/docs/about/installation.mdx @@ -80,7 +80,7 @@ sudo loginctl enable-linger $USER Install the OpenShell snap from the Snap Store: ```shell -sudo snap install openshell --classic +sudo snap install openshell ``` The snap defines two apps: the `openshell` CLI and the `openshell.gateway` @@ -89,6 +89,11 @@ stores its database at `$SNAP_COMMON/gateway.db` (typically `/var/snap/openshell/common/gateway.db`). Create `$SNAP_COMMON/gateway.toml` when you need to override gateway settings. +The snap CLI stores per-user config, data, and state under `$SNAP_USER_COMMON`, +typically `~/snap/openshell/common`. Gateway registrations live under +`$SNAP_USER_COMMON/.config/openshell/gateways/` instead of +`~/.config/openshell/gateways/`. + ### Snap store installs When installing from the Snap Store, snapd automatically connects the `home`, @@ -108,7 +113,7 @@ manually. When installing a locally built `.snap` file, no plugs are connected by default: ```shell -sudo snap install ./openshell_*.snap --dangerous --classic +sudo snap install ./openshell_*.snap --dangerous sudo snap connect openshell:home sudo snap connect openshell:network sudo snap connect openshell:network-bind