Flatpak

flatpak — Build, install and run applications and runtimes

Flatpak (formerly xdg-app) is a software utility for software deployment and package management for Linux.

flatpak list
flatpak run org.mozilla.Thunderbird
flatpak info org.videolan.VLC
flatpak uninstall --unused -y

Applications files are contained in /var/lib/flatpak
User specific data is are stored in ~/.var/app

flatpak-list — List installed applications and/or runtimes

flatpak list
flatpak list --app
flatpak list --columns=name

Get what applications depend on which runtime component

flatpak list --app --columns=application,runtime

flatpak-override — Override application requirements

https://docs.flatpak.org/en/latest/flatpak-command-reference.html#flatpak-override

Overrides the application specified runtime requirements. This can be used to grant a sandboxed application more or less resources than it requested.

To display the current overrides (global, app specific, with/without --user switch):

flatpak override --show
flatpak override --show org.videolan.VLC
flatpak override --user --show
flatpak override --user --show org.videolan.VLC

filesystem

Allow the application access to a subset of the filesystem.

flatpak override --user --filesystem=xdg-documents org.mozilla.firefox
flatpak override --user --filesystem=xdg-pictures org.mozilla.firefox

reset

Remove overrides. If an APP is given, remove the overrides for that application, otherwise remove the global overrides.

flatpak override --reset
flatpak override --reset org.mozilla.firefox
flatpak override --reset --user org.mozilla.firefox

Documentation: https://docs.flatpak.org/en/latest/flatpak-command-reference.html

Overrides files (edited by flatpak override) are in:

  • /var/lib/flatpak/overrides
  • ~/.local/share/flatpak/overrides

flatpak-run — Run an application or open a shell in a runtime

https://docs.flatpak.org/en/latest/flatpak-command-reference.html#flatpak-run

flatpak run --runtime-version=3.38 org.gnucash.GnuCash
nohup flatpak run org.signal.Signal --start-in-tray &

flatpak-remote-info – Show information about an application or runtime in a remote

flatpak remote-info --log flathub net.ankiweb.Anki

flatpak-update – Update an application or runtime

switches

flatpak update --commit=5089f63b4c9fdf3e48a7ca2f81aba02c974fba1995728fe2711bed437ae4ecf2 net.ankiweb.Anki

flatpak-mask – Mask out updates and automatic installation

–removeInstead of adding the patterns, remove matching patterns.
–userMask refs in a per-user installation.
flatpak mask net.ankiweb.Anki
flatpak mask --remove net.ankiweb.Anki

Tips and tricks

https://docs.flatpak.org/en/latest/tips-and-tricks.html

GUI

flatseal

Integration in desktop

There are links to the applications there in /var/lib/flatpak/exports/bin that can be used as preferred applications.

Debian

Use update-alternatives:

sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /var/lib/flatpak/exports/bin/org.mozilla.firefox 200
sudo update-alternatives --set x-www-browser /var/lib/flatpak/exports/bin/org.mozilla.firefox

https://wiki.debian.org/Firefox

Gnome

xdg-desktop-portal-gtk

Gtk implementation of xdg-desktop-portal on flatpak.

KDE/Qt

HiDPI:

QT_AUTO_SCREEN_SCALE_FACTOR=1

Add switches to an application

Copy the .desktop file needed from: /var/lib/flatpak/exports/share/applications to ~/.local/share/applications and edit it there to mask the global one.

Misc

Wayland

The flatpak build requires --socket=wayland to be set for Wayland support to be enabled.

flatpak override --socket=wayland
flatpak override --env=MOZ_ENABLE_WAYLAND=1
flatpak override --env=VDPAU_DRIVER=radeonsi

flatpak override --user --socket=wayland org.videolan.VLC

flatpak override --user --show org.videolan.VLC

VLC

Weirdly, for VDPAU, vlc needs:

LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/GL/default/lib/vdpau/

even if… the path does not even exist on the system (??)

Debug

https://docs.flatpak.org/en/latest/debugging.html