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.
- Use
g_get_user_config_dir(),g_get_user_cache_dir()andg_get_user_data_dir()to find the right place to store configuration and data - Use
GtkFileChooserNative(orGtkFileChooserButton) to open files. Note that portals cannot currently give access to directories on the host filesystem - Use
GtkPrintOperationfor printing - Use
gtk_show_uri_on_window()org_app_info_launch_default_for_uri()to open URIs - Use
gtk_application_inhibit()if you want to inhibit idle or logout - Use
g_application_send_notification()to show notifications - Use the
GtkApplication::screensaver-activeproperty to monitor scrensaver status