DEV Community

Ivan Alejandro
Ivan Alejandro

Posted on • Originally published at ivanalejandro0.com

1

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Use cases

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

  • logging in into multiple accounts on some app at the same time, maybe Teams or Zoom.
    • this can be useful to isolate them from each other, or
    • to use multiple accounts when it's not supported natively by the app
  • playing around with an app and its configurations without worrying about breaking your main working app
  • use this isolation to contain the data for a "disposable" instance you want to run, for tests/experiments/etc

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay