Skip to content

Commit e4d7d41

Browse files
authored
fix(snap): use snap-owned XDG directories (#1972)
1 parent d93293a commit e4d7d41

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

docs/about/installation.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ sudo loginctl enable-linger $USER
8080
Install the OpenShell snap from the Snap Store:
8181

8282
```shell
83-
sudo snap install openshell --classic
83+
sudo snap install openshell
8484
```
8585

8686
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
8989
`/var/snap/openshell/common/gateway.db`). Create `$SNAP_COMMON/gateway.toml`
9090
when you need to override gateway settings.
9191

92+
The snap CLI stores per-user config, data, and state under `$SNAP_USER_COMMON`,
93+
typically `~/snap/openshell/common`. Gateway registrations live under
94+
`$SNAP_USER_COMMON/.config/openshell/gateways/` instead of
95+
`~/.config/openshell/gateways/`.
96+
9297
### Snap store installs
9398

9499
When installing from the Snap Store, snapd automatically connects the `home`,
@@ -108,7 +113,7 @@ manually.
108113
When installing a locally built `.snap` file, no plugs are connected by default:
109114

110115
```shell
111-
sudo snap install ./openshell_*.snap --dangerous --classic
116+
sudo snap install ./openshell_*.snap --dangerous
112117
sudo snap connect openshell:home
113118
sudo snap connect openshell:network
114119
sudo snap connect openshell:network-bind

snapcraft.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ platforms:
6262
apps:
6363
openshell:
6464
command: bin/openshell
65+
environment:
66+
XDG_CONFIG_HOME: "$SNAP_USER_COMMON/.config"
67+
XDG_DATA_HOME: "$SNAP_USER_COMMON/.local/share"
68+
XDG_STATE_HOME: "$SNAP_USER_COMMON/.local/state"
6569
plugs:
6670
- home
6771
- network
@@ -70,6 +74,10 @@ apps:
7074
term:
7175
command: bin/openshell term
7276
desktop: meta/gui/term.desktop
77+
environment:
78+
XDG_CONFIG_HOME: "$SNAP_USER_COMMON/.config"
79+
XDG_DATA_HOME: "$SNAP_USER_COMMON/.local/share"
80+
XDG_STATE_HOME: "$SNAP_USER_COMMON/.local/state"
7381
plugs:
7482
- home
7583
- network

0 commit comments

Comments
 (0)