Kirsle.net logo Kirsle.net

Flatpak

Tips and tricks to work around Flatpak jank.

Tip: Install --user Flatpaks to skip admin password prompts

For example when you are installing the Flathub repository, they give you the command like:

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

Insert a --user option instead to install this repo for your user account:

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

Now you can simply flatpak install firefox and so on without any prompt for your sudoer password. By having Flathub only on --user you avoid accidentally installing from Flathub as a system-wide (admin) repository. I find it best not to mix and match for a single-user system.

In case you do mix and match, the --user option can apply to other Flatpak commands such as flatpak install --user or flatpak update --user.

Tip: Reboot after setting up Flatpak/Flathub

e.g. on a fresh Debian install you must apt install flatpak and the Flathub instructions tell you to restart your computer. This is important!

Problems you will run into if you don't reboot include:

  • Application launchers not appearing in your app menu
  • URL handlers not registering correctly, e.g. Slack or Zoom will open your web browser to authenticate and the browser tries to activate an app URI like zoommtg:// and this won't work correctly. Rebooting fixed it!

Tip: Using Flatpak apps as your Default Apps

e.g. on an Xfce desktop environment you want your Web Browser to be org.mozilla.firefox and your Mail Client to be org.mozilla.thunderbird

Flatpak binary commands (as in for your $PATH) live at the following locations:

  • ~/.local/share/flatpak/exports/bin (user apps)
  • /usr/local/share/flatpak/exports/bin (system apps)

So you can just browse for e.g. ~/.local/share/flatpak/exports/bin/org.mozilla.firefox when picking your Web Browser.

Mouse cursor isn't consistent

See https://github.com/flatpak/flatpak/issues/709

Flatpak apps may have issues using your system cursor theme (e.g. Adwaita) and seem to fall back to an ugly default X11 cursor theme.

An elegant solution for all Flatpak apps:

flatpak --user override --filesystem=/home/$USER/.icons/:ro
flatpak --user override --filesystem=/usr/share/icons/:ro

Note: the first line is only needed if you are installing custom cursor themes to your ~/.icons folder; if just using system installed themes the latter line will do the trick. Then just restart the Flatpak apps!

Firefox: Fonts rendering poorly

See https://bugzilla.mozilla.org/show_bug.cgi?id=1621915

The Flatpak build of Firefox may render ugly bitmap fonts especially on sites like GitHub, while some other sites render OK.

The workaround: paste this XML into ~/.var/app/org.mozilla.firefox/config/fontconfig/fonts.conf:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
    <!-- Disable bitmap fonts. -->
    <selectfont><rejectfont><pattern>
        <patelt name="scalable"><bool>false</bool></patelt>
    </pattern></rejectfont></selectfont>
</fontconfig>