XDG_CONFIG_HOME for classic snaps


I’ve created a snap package of alacritty with classic confinement. Recently, I started using snapcraft-desktop-helpers as it helps for both GL related issues and for setting environment variables properly.

The problem is, it also sets variables like XDG_CONFIG_HOME to $SNAP_USER_DATA/.config which is kind of problematic for an app with classic confinement. In my case, alacritty searches for its config file in this folder but it doesn’t exist. One would say “that’s fine, just move the config file” but there are other apps (maybe started inside alacritty) which will look for their configuration files inside alacritty’s $SNAP_USER_DATA – an example is neovim.

So when I start alacritty, its XDG_CONFIG_HOME is set to $SNAP_USER_DATA/.config – then if I start neovim inside alacritty, it’ll search for its config inside alacritty’s snap folder.

I created an issue on Github. Is there something I can do to change this behaviour? I couldn’t find any special variable/file that I could set/save to change it.

1 Like

use a command-chain wrapper and follow:

to set XDG_CONFIG_HOME pointing to the real home yourself.

by default snaps use the per-app homedir by design (so the app does not break if the home interface gets disconnected for some reason (i.e. paranoid admins or whatnot) in strict snaps and snap rollback/refresh can use per-version configurations …

it is indeed up to you to make sure rollback/refresh changes of incompatible config options between versions are handled by the app then…

Note that you can get the “real home” via SNAP_REAL_HOME

$ snap run --shell hello-world
user@localhost:/home/user$ echo $HOME
user@localhost:/home/user$ echo $SNAP_REAL_HOME