Flatpak: a basic guide

Install flatpak and flathub

Installing Flatpaks is quite easy and convenient. Managing them, on the other hand, can be a challenge.

Let’s go over the basics: install Flatpak using your package manager. I use Void Linux, so in my case: sudo xbps-install -S flatpak, then:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Basic commands

This command adds the flathub as a flatpak repository (really, the only flatpak repository I know someone can use).

Now you are ready to install packages though flatpak. Note that in oreder for the installed packages to show up in your application menu you need to reboot once.

Let’s go over the most used commands:

  • To look for packages: flatpak search <package>;

  • To install a package: flatpak install <package>;

  • To start a package: flatpak run <package>;

  • To update all packages: flatpak update;

  • To remove a package: flatpak remove <package>;

  • To have a list of installed packages: flatpak list.

Tips

Set GTK theme

You’ll note that packages installed though flatpak don’t share you system theme.

To fix this, make a directory in your home folder or subfolder containing your gtk themes, if it doesn’t already exist. I’ll use my .themes folder:

mkdir -p ~/.themes

Note: you’ll most likely have it already if you use lxappearance, since it’s one of the directories it uses to get themes.

Put the gtk theme you want to use inside the themes folder. I’ll use Catppuccin-Mocha-Blue. Then copy and paste this command (replace Catppuccin-Mocha-Blue with your theme):

sudo flatpak override --filesystem=$HOME/.themes
sudo flatpak override --env=GTK_THEME=Catppuccin-Mocha-Blue

Run from terminal

Sometimes you need to run flatpak packages from your terminal, but you’ll soon notice that typing the name of the package in the terminal shows up no results. That’s because flatpak packages are installed under their ID name.

For example: typing flatpak run discord in your terminal will give you an error, but if you type flatpak run com.discordapp.Discord will start Discord (provided you have Discord installed, of course).

To know installed application IDs, use flatpak list.

If you want to know one specific application ID, use

flatpak list | grep <application>

Remember: it’s case sensitive, and most flatpak packages start with a capital letter).

Manage app permissions

Most flatpak applications have a fair restriction on their permissions. Sometimes, though, You’ll want to add a permission to an application. For example, Discord can’t access your home folder by default, so you can’t share files from your $HOME.

To manage app permissions, install Flatseal:

flatpak install flatseal

Once installed, you’ll be able to manually set every flatpak application’s permission.

Francesco Lanza

Italian Computer Science student, aspiring Software Architect.


2023-01-11