| 1 |
Building & Running |
| 2 |
================== |
| 3 |
|
| 4 |
Normally, XDG Desktop Portal runs as a user session service, initialized on |
| 5 |
demand through D-Bus activation. It usually starts with the session though, |
| 6 |
as many desktop environments try to talk to XDG Desktop Portal on startup. |
| 7 |
XDG Desktop Portal initializes specific backends through D-Bus activation |
| 8 |
as well. |
| 9 |
|
| 10 |
|
| 11 |
Building |
| 12 |
-------- |
| 13 |
|
| 14 |
To build XDG Desktop Portal, first make sure you have the build dependencies |
| 15 |
installed through your distribution's package manager. With them installed, |
| 16 |
run: |
| 17 |
|
| 18 |
.. code-block:: shell |
| 19 |
|
| 20 |
meson setup . _build |
| 21 |
meson compile -C _build |
| 22 |
|
| 23 |
Some distributions install portal configuration files in ``/usr``, while Meson |
| 24 |
defaults to the prefix ``/usr/local``. If the portal configuration files in your |
| 25 |
distribution are in ``/usr/share/xdg-desktop-portal/portals``, re-configure |
| 26 |
Meson using ``meson setup --reconfigure . _build --prefix /usr`` and compile |
| 27 |
again. |
| 28 |
|
| 29 |
|
| 30 |
Running |
| 31 |
------- |
| 32 |
|
| 33 |
XDG Desktop Portal needs to own the D-Bus name and replace the user session |
| 34 |
service that might already be running. To do so, run: |
| 35 |
|
| 36 |
.. code-block:: shell |
| 37 |
|
| 38 |
_build/src/xdg-desktop-portal --replace |
| 39 |
|
| 40 |
If you are developing inside a ``toolbox`` container, you must use |
| 41 |
``flatpak-spawn`` from ``flatpak-xdg-utils`` to run the service: |
| 42 |
|
| 43 |
.. code-block:: shell |
| 44 |
|
| 45 |
flatpak-spawn --host _build/src/xdg-desktop-portal --replace |
| 46 |
|
| 47 |
You may need to restart backends after replacing XDG Desktop Portal (please |
| 48 |
replace ``[name]`` with the backend name, e.g. ``gnome`` or ``kde`` or ``wlr``): |
| 49 |
|
| 50 |
.. code-block:: shell |
| 51 |
|
| 52 |
systemctl --user restart xdg-desktop-portal-[name].service |
| 53 |
|
| 54 |
Testing |
| 55 |
------- |
| 56 |
|
| 57 |
To execute the test suite present in XDG Desktop Portal, run: |
| 58 |
|
| 59 |
.. code-block:: shell |
| 60 |
|
| 61 |
meson test -C _build |
| 62 |
|
| 63 |
Enable the pre-commit hooks to catch issues early: |
| 64 |
|
| 65 |
.. code-block:: shell |
| 66 |
|
| 67 |
git config --local core.hooksPath .githooks/ |
| 68 |
|
| 69 |
When a branch is pushed to github, CI will also run tests in a few more |
| 70 |
configurations. |
| 71 |
|
| 72 |
Documentation |
| 73 |
------------- |
| 74 |
|
| 75 |
These instructions are for Fedora, where you will need these packages: |
| 76 |
|
| 77 |
.. code-block:: |
| 78 |
|
| 79 |
sudo dnf install json-glib-devel fuse3-devel gdk-pixbuf2-devel pipewire-devel python3-sphinx flatpak-devel python3-furo python-sphinxext-opengraph python-sphinx-copybutton |
| 80 |
|
| 81 |
Then you can build the website with: |
| 82 |
|
| 83 |
.. code-block:: shell |
| 84 |
|
| 85 |
meson setup . _build -Ddocumentation=enabled |
| 86 |
ninja -C _build |
| 87 |
|
| 88 |
Then just load the build website into a browser of your choice from |
| 89 |
``_build/doc/html/index.html`` |