Flatpak
Flatpak is a package management framework aiming to provide support for sandboxed, distro-agnostic binary packages for Linux desktop applications.
Installation
USE flags
USE flags for sys-apps/flatpak Linux application sandboxing and distribution framework
X
|
Add support for X11 |
doc
|
Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally |
introspection
|
Add support for GObject based introspection |
policykit
|
Enable PolicyKit (polkit) authentication support |
seccomp
|
Enable seccomp (secure computing mode) to perform system call filtering at runtime to increase security of programs |
systemd
|
Enable use of systemd-specific libraries and features like socket activation or session tracking |
Emerge
Chromium-based browsers suggest disabling the
suid
USE flag for sys-apps/bubblewrap for performance reasons. Also there are technologies such as Valve Pressure Vessel (used in Steam) which requires it to work. Without suid
, bubblewrap requires the kernel option CONFIG_USER_NS=y
to be set.Flatpak installation guide suggested to restart the system after installation. This might be no longer necessary.
root #
emerge --ask sys-apps/flatpak
Add flathub repository
All operations with flatpak can be performed as user or as root, if performing as user --user flag can help if there are issues with permissions.
user $
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Configuration
Files
- /var/lib/flatpak - global flatpak state (system-wide installed apps and repos)
- ~/.local/share/flatpak - per-user flatpak state (locally installed apps and repos)
- ~/.var/app/ - per application state (configuration files and cache)
Permissions
In some instances, it may be necessary to edit the sandbox permissions of a flatpak application. The most convenient way of doing this is via the GUI tool Flatseal.
user $
flatpak install com.github.tchx84.Flatseal
Basic usage
To install an application, e.g. Thunderbird, run:
user $
flatpak --user install org.mozilla.Thunderbird
To run the application use created .desktop file or run:
user $
flatpak run org.mozilla.Thunderbird
To update installed applications and runtimes:
user $
flatpak update
Theming
Flatpak documentiation offers a good guide about desktop integration and theming.
GTK
Flatpak applications don't follow the system's GTK theme by default. First find out what's the current GTK theme, e.g. Materia-dark-compact, and then install it for Flatpak applications to use. [1]
user $
gsettings get org.gnome.desktop.interface gtk-theme
user $
flatpak install flathub org.gtk.Gtk3theme.Materia-dark-compact
Desktop integration for Wayland
When using WMs such as Sway, installing xdg portals is needed for full integration. There are backends available for this matter:
- GTK backend: 'xdg-desktop-portal-gtk'
- KDE backend 'xdg-desktop-portal-kde' (in development)
- Wayland/wlroots backend: 'xdg-desktop-portal-wlr' (in development)
- LXQt backend 'xdg-desktop-portal-lxqt' (in development)
- Flatpak backend: 'flatpak-portal' (included in the Flatpak package)
Please note that these are separate entities that and do not substitute each other and you may need to run some of them at once.
Installation
root #
emerge --ask sys-apps/xdg-desktop-portal
root #
emerge --ask sys-apps/xdg-desktop-portal-gtk
root #
emerge --ask gui-libs/xdg-desktop-portal-wlr
root #
emerge --ask gui-libs/xdg-desktop-portal-lxqt
Ensuring portals are running
Please note that sometimes these libraries aren't pulled automatically by the OS and need to be run by the user, for example they can be pulled in Sway configuration:
~/.config/sway/config
Running xdg portalsexec /usr/libexec/xdg-desktop-portal-gtk -r exec /usr/libexec/xdg-desktop-portal-wlr -r exec /usr/libexec/flatpak-portal -r exec "sh -c 'sleep 5;exec /usr/libexec/xdg-desktop-portal -r'"
Flatpaked GTK apps under Wayland and jagged fonts
Some users report jagged fonts on Wayland. That happened because if GTK apps can't detect whether they should perform font antialiasing, they disable ones by default. It obtain info ether from the system or via xdg-desktop-portal-gtk if flatpaked. It also requires you to setting up the proper wayland scheme for it from gnome-base/gsettings-desktop-schemas, but that package already in list of flatpak dependencies.
So workaraund is to install xdg-desktop-portal-gtk and reboot/restart the desktop:
root #
emerge --ask sys-apps/xdg-desktop-portal-gtk
You may make sure if it is launched via topic "Ensuring portals are running" above.
Since in early 2022 GTK wayland schemas are moved from gnome-base/gnome-settings-daemon to gnome-base/gsettings-desktop-schemas, the gnome settings daemon is no more required and can be uninstalled.
Troubleshooting
After updating nvidia-drivers 3D applications will crash or are super slow
Make sure to update the flatpak nvidia platform.
user $
flatpak update
See also
- Docker — a container virtualization environment
- LXD — is a next generation system container manager.