10

Applications installed with Flatpak are keeping user data and configuration under ~/.var/app/ (see Wiki and documentation).

I would like the applications installed with Flatpak to reuse the configuration and data left from the system versions of the same applications. That is, I want them to keep user data in ~/.local/share, ~/.config, ~/.cache, instead of under ~/.var/app.

At first I was hoping that configuring environment variables XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_CACHE_HOME could suffice, or that it could be enough to start the application with --filesystem options:

 $ flatpak run --filesystem=xdg-config --filesystem=xdg-cache \
  --filesystem=xdg-data <application-id>

However, this did not seem to work.

What is the correct way to make Flatpak applications reuse user data and configurations in standard locations?

Alexey
  • 1,868
  • 4
  • 20
  • 35
  • Can you expand on what you're trying to do here? It's confusing. – slm Aug 03 '18 at 03:54
  • 1
    Sorry,what is confusing? I want the applications like Skype or Lollypop that I install with Flatpak keep their data in the same locations in the user home folder where they would normally do when installed on Ubuntu with `apt` from some PPA. That way I would be able to easily replace a PPA version with Flatpak version and vice versa. – Alexey Aug 03 '18 at 04:18
  • 1
    Are you trying to get all of a specific user's apps to maintain it's data in `~/.var/app` or do you want to share data across a given app to all users? – slm Aug 03 '18 at 04:19
  • 2
    I do not want Flatpak apps to keep their data in `~/.var/app`, I want them to store it in `~/.local/share`, `~/.config`, `~/.cache`. – Alexey Aug 03 '18 at 04:22
  • OK, so you want to override where Flatpak keeps its data. – slm Aug 03 '18 at 04:25
  • As a workaround, why not just make symlinks out of that dir to where you want it? – slm Aug 03 '18 at 04:25
  • Assuming you saw this page? - https://github.com/flatpak/flatpak/wiki/Filesystem. – slm Aug 03 '18 at 04:28
  • 1
    It feels a bit like hacking the implementation instead of using an interface... I was hoping that there were some options I could set. – Alexey Aug 03 '18 at 04:34
  • Let's call it plan B 8-) – slm Aug 03 '18 at 04:34
  • What didn't work with the env variables? Those seem like the way to do this? – slm Aug 03 '18 at 04:38
  • There's this thread from hell too - https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1575053. – slm Aug 03 '18 at 04:40

1 Answers1

1

I was able to get this to work by specifying the directory after --filesystem=xdg-config and including mount parameters after that. I'm not sure if the mount parameters are necessary, but try putting this in this finish-args section of your application's manifest .json.

"finish-args": [
    "--filesystem=xdg-config/<config-dir>:create",
    "--filesystem=xdg-cache/<cache-dir>:create",
    "--filesystem=xdg-data/<data-dir>:create"
],
bscubed
  • 11
  • 2