#linux #flatpak #tips

Use a custom data folder on Flatpak apps

The problem

You want to use different data/configuration folders for a Flatpak application, or maybe run multiple instances independent from each other.

I read through Flatpak’s man pages, cli help and documentation but I didn’t find a solution to my problem.

The solution

Run the flatpak app with a different HOME env variable.

env HOME=/path/to/your/custom/flatpak/home flatpak run your-app

And that’s pretty much it, everything related to running this specific app will be contained on that path you just used. And subsequent runs will work just as it would if you’d use the default home.

Example

For example, let’s say we want a separate instance of Zoom (Zoom on Flathub) to run along the default one.

And also, let’s use Flatseal to manage the flatpak app permissions.

I also created a couple of scripts to simplify the task of starting them up:

$ cat zoom.sh
#!/bin/sh
env HOME=$(pwd)/custom-flatpak-home flatpak run us.zoom.Zoom

$ cat flatseal.sh
#!/bin/sh
env HOME=$(pwd)/custom-flatpak-home flatpak run com.github.tchx84.Flatseal

Here’s how the data folder looks like:

~/apps/zoom.1$ tree -L 4 -a
.
├── custom-flatpak-home
│   ├── .cache
│   │   └── flatpak
│   │       └── system-cache
│   ├── Documents
│   │   └── Zoom
│   ├── .local
│   │   └── share
│   │       └── flatpak
│   ├── .var
│   │   └── app
│   │       ├── com.github.tchx84.Flatseal
│   │       └── us.zoom.Zoom
│   └── .zoom
│       ├── data
│       │   ├── com.zoom.ipc.assistantapp__req
│       │   ├── com.zoom.ipc.assistantapp__res
│       │   └── zoomus.enc.v2.db
│       ├── im
│       ├── logs
│       │   └── zoom_stdout_stderr.log
│       ├── reports
│       └── screenCapture
├── flatseal.sh
└── zoom.sh

19 directories, 6 files

Use cases

How can you take advantage of this? or what could this be useful for?