Flatpak

From Gentoo Wiki
Jump to:navigation Jump to:search
Warning
Flatpak is thought to have serious security concerns[1] that should be considered before using Flatpak on secure systems.

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

doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
gtk Add support for x11-libs/gtk+ (The GIMP Toolkit)
introspection Add support for GObject based introspection
kde Add support for software made by KDE, a free software community
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

Note
Chromium-based browsers suggest disabling suid USE-flag for sys-apps/bubblewrap for performance reasons.
Note
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

Tip
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)

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. [2]

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 different 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)

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

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:

FILE ~/.config/sway/configRunning xdg portals
exec /usr/libexec/xdg-desktop-portal-gtk -r
exec /usr/libexec/xdg-desktop-portal-wlr -r
exec "sh -c 'sleep 5;exec /usr/libexec/xdg-desktop-portal -r'"

Troubleshooting

Fixing jagged fonts on Wayland

Some users report jagged fonts on Wayland. The workaround is to install gnome-settings-daemon.[3]

root #emerge --ask gnome-base/gnome-settings-daemon

See also

  • Docker — a container virtualization environment
  • LXD — is a next generation system container manager.

References