Debian Codegraph @

doc/reasons-to-use-portals.rst

raw
1 Reasons to Use Portals
2 ======================
3
4 Using XDG Desktop Portal brings major advantages over writing desktop-specific
5 code for app developers:
6
7 * **Strict sandbox**: portals enable sandboxed apps to access a curated set of
8 features from the desktop environment and the host system, without weakening
9 the sandbox of the app.
10 * **Unified code**: by using portal APIs, apps only need to write a single
11 desktop-agnostic code that runs on a variety of desktop environments. Portals
12 can be used by sandboxed and unsandboxed apps alike. App developers are
13 encouraged to use portal APIs even for unsandboxed apps.
14 * **Seamless integration**: portal backends provide cost-free integration with
15 the desktop. For example, simply using the :ref:`File Chooser portal<org.freedesktop.portal.FileChooser>`
16 will make apps use the file picker dialog native to the desktop environment
17 they're running on.
18 * **Permission system**: portals can restrict access to system resources through
19 a permission system. Permissions can be granted, revoked, and controlled
20 individually by the end user. This gives end users more control over apps.
21
22 In addition to the reasons above, some desktop features are primarily - and
23 sometimes exclusively - available through portals. For example, the primary way
24 of capturing screens and windows on Wayland desktops is through the
25 :ref:`ScreenCast portal<org.freedesktop.portal.ScreenCast>`, and some desktop
26 environments don't even expose other means to capture the screen or windows.