Portal support in GTK¶
GTK will transparently use portals for some functionality when it detects that it is being used inside a Flatpak sandbox. Here are some hints for what GTK applications should do to benefit from this.
g_get_user_data_dir()to find the right place to store configuration and data
GtkFileChooserButton) to open files. As of xdg-desktop-portal-gtk 1.7.1 it can also open directories.
g_app_info_launch_default_for_uri()to open URIs
gtk_application_inhibit()if you want to inhibit idle or logout
g_application_send_notification()to show notifications
- Use the
GtkApplication::screensaver-activeproperty to monitor scrensaver status
Additionally, xdg-desktop-portal-gtk is required for GTK themes and fonts. It is also used as a fallback for the filepicker if the main xdg-desktop-portal implementation doesn’t support filepicking.
Portal support in Qt and KDE¶
Qt and KDE libraries will transparently use portals for some functionality when they detect that they are being used inside a Flatpak sandbox. Here are some hints for what Qt or KDE applications should do to benefit from this.
QDesktopServices::openUrl(const QUrl &url)or
KIO::OpenUrlJobto open URIs or send an email when using
QFileDialogclass to open files and, as of Qt
5.18.90, directories. Avoid using
QFileDialog::DontUseNativeDialog. Note that portals cannot currently give access to directories on the host filesystem
KNotification::notify()to show notification