Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 20 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# File generated by pre-commit: https://pre-commit.com
# ID: 138fd403232d2ddd5efb44317e38bf03

# start templated
INSTALL_PYTHON=/usr/bin/python3
ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-commit)
# end templated

HERE="$(cd "$(dirname "$0")" && pwd)"
ARGS+=(--hook-dir "$HERE" -- "$@")

if [ -x "$INSTALL_PYTHON" ]; then
exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}"
elif command -v pre-commit > /dev/null; then
exec pre-commit "${ARGS[@]}"
else
echo '`pre-commit` not found. Did you forget to activate your virtualenv?' 1>&2
exit 1
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
10 changes: 10 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[mypy]
warn_unused_configs = True
check_untyped_defs=True

[mypy-gi.*]
ignore_missing_imports = True
[mypy-dbus.*]
ignore_missing_imports = True
[mypy-dbusmock.*]
ignore_missing_imports = True
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.7.0
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
args: [ --check ]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies:
- pytest
64 changes: 2 additions & 62 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,4 @@
# XDG Desktop Portal - Contributing Guide

Before developing features or fixing bugs, please make sure you are have done
the following:

- Your code is not on the *main* branch of your fork
- The code has been tested
- All commit messages are properly formatted and commits squashed where
appropriate
- You have included updates to all appropriate documentation

We use GitHub pull requests to review contributions. Please be kind and patient
as code reviews can be long and minutious.

## Development

xdg-desktop-portal usually runs as a user session service, initialized on
demand through D-Bus activation. It usually starts with the session though,
as many desktop environments try to talk to xdg-desktop-portal on startup.
xdg-desktop-portal initializes specific backends through D-Bus activation
as well.

### Building

To build xdg-desktop-portal, first make sure you have the build dependencies
installed through your distribution's package manager. With them installed,
run:

```
$ meson setup . _build
$ meson compile -C _build
```

Some distributions install portal configuration files in `/usr`, while Meson
defaults to the prefix `/usr/local`. If the portal configuration files in your
distribution are in `/usr/share/xdg-desktop-portal/portals`, re-configure
Meson using `meson setup --reconfigure . _build --prefix /usr` and compile
again.

### Running

xdg-desktop-portal needs to own the D-Bus name and replace the user session
service that might already be running. To do so, run:

```
$ _build/src/xdg-desktop-portal --replace
```

You may need to restart backends after replacing xdg-desktop-portal (please
replace `[name]` with the backend name, e.g. `gnome` or `kde` or `wlr`):

```
$ systemctl --user restart xdg-desktop-portal-[name].service
```

### Testing

To execute the test suite present in xdg-desktop-portal, make sure you built it
with `-Dlibportal=enabled`, and run:

```
$ meson test -C _build
```

The contribution guidelines have been moved to the online documentation:
https://flatpak.github.io/xdg-desktop-portal/docs/for-contributors.html
222 changes: 189 additions & 33 deletions NEWS → NEWS.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,199 @@
Changes in 1.18.4
Changes in 1.20.3
=================
Released: 2024-04-18
Released: 2025-05-20

- Don't allow commandline arrays when the first commandline item starts with
whitespace or hyphen. (CVE-2024-32462)
- Do not store device access permission if it returned an error.
- Fix crash with config files without a default backend set.
Bug Fixes:

Changes in 1.18.3
- Add a fallback code path for GLib older than 2.76 (#1728)
- Don't require a .desktop file for Flatpak and Snap apps (#1729)

Changes in 1.20.2
=================
Released: 2025-05-19

Bug Fixes:

- Fix a crash when loading information from Flatpak apps
- Fix fd handling to prevent EBADF errors

Changes in 1.20.1
=================
Released: 2025-05-15

Enhancements:

- Code cleanups and improvements to app info tracking
- Include PID/TID in realtime portal error messages
- Search for portal backends in $XDG_DATA_DIRS (#603)
- Prioritize user portal configs over system ones

Bug Fixes:

- Fix race condition in the host registry portal
- Avoid spurious warnings when dbus.service stops
- Documentation fixes (#1663)
- Fix running tests from /tmp
- Fix installing dynamic launcher (#1674)
- Improve error reporting in the document portal
- Fix incorrect state tracking in input capture portal

Changes in 1.20.0
=================
Released: 2025-02-19

Enhancements:

- Document how the test suite works.
- Improve the test runner script.

Changes in 1.19.4
=================
Released: 2025-02-15

New Features:

- Introduce the host app registry. This interface allows host system apps
(i.e. apps not running under a sandboxing mechanism like Flatpak) register
themselves with XDG Desktop Portal. This allows XDG Desktop Portal to use
a proper app id, and desktop file, improving the interaction with portal
backends.

Enhancements:

- Use a new internal script to simplify running tests.

Bug Fixes:

- Properly escape notification body in the Notification portal.
- Fix various documentation links in the USB portal documentation page.

Changes in 1.19.3
=================
Released: 2024-04-04
Released: 2025-02-12

Bug Fixes:

- Fix documentation links in the USB portal page.
- Make the Document portal track open files, and release them when shutting
down. This should fix some harmless leak reports.
- Fix a memory leak, a crash, and improve robustness against non-existing
folders in the Dynamic Launcher portal.
- Fix build with PipeWire 1.3.82

Enhancements:

- Make the host path xattr more useful by removing the trailing end character,
and also reporting the xattr of files inside folders added to the document
store.
- Remove libportal-based integrated tests. This should remove the cyclic
dependency between libportal, and xdg-desktop-portal. All tests are now based
on the Python testing framework.

Changes in 1.19.2
=================
Released: 2025-01-20

Bug Fixes:

- Fix permission check for host system apps in the Camera portal.
- Do not expose the Settings portal if there are no backends available.
- Disable sounds-related notification tests if the project is built without
wavparse.

Enhancements:

- Start porting the test suite to Python tests. Once finished, this should
break the cyclic dependency between xdg-desktop-portal and libportal.
- Install Python-based tests. This is mostly useful for distributions to run
tests as part of their packaging process.

Changes in 1.19.1
=================
Released: 2024-12-21

Dependencies:

- XDG Desktop Portal now requires GLib 2.72 or higher.

New Features:

- Introduce the Notification v2 portal. This updated version of the Notification
portal supports a plethora of new fields for notifications, such as sounds,
categories, purpose, and more.
- Introduce the USB portal. This portal allows apps with relevant permissions
to enumerate and acquire access to specific USB devices.
- Introduce a new `SchemeSupported` method to the OpenURI portal. This new
method allows apps to know ahead of time if the host system is able to deal
with a particular scheme.

Enhancements:

- Continued the move towards Python-based tests. This should simplify the
test setup in the project quite significantly, and also will allow removing
the cyclic dependency between libportal and XDG Desktop Portal.
- Introduce umockdev-based tests.
- Improve the icon validator so it can deal with memfd-based icons.
- Clarify behavior of the Settings portal for non-standardized keys.
- In the Global Shortcuts portal, clarify that the result the `BindShortcuts`
of may be a subset of all requested shortcuts.
- Add a documentation page about icon validation requirements.

Bug Fixes:

- Don't try to read D-Bus object properties of Request objects on construction.
- Fix various memory and file descriptor leaks.
- Minuscule optimization to the ScreenCast portal so that it stores restoration
data with a single D-Bus call, instead of two.
- Fix a crash in the OpenURI file when trying to open a non-existing file.
- Various smaller bug fixes.
- Fix memory leaks in the Background, Email, and Global Shortcuts portals.
- Fix a general file descriptor & memory leak.
- Fix a regression in the Settings portal.
- New and updated translations.

Changes in 1.18.2
Changes in 1.19.0
=================
Released: 2023-11-22

- Pass the token to the OpenURI portal and, when missing, an empty string.
- Fix various memory and file descriptor leaks in the Document portal.
- Make files and folders openend with the Document portal close properly. This
should fix cases where the Document portal prevented external devices from
unmounting, due to files inside them not getting closed after applications
stop using them.
- Implement FUSE getlk and setlk callbacks.This should enable using sqlite3
through the Document portal.
- Properly resolve fd symlinks before opening them with O_NOFOLLOW.
- Fix cases where the portal id is assumed to match the .desktop file name.
- Allow sending directories in the file transfer portal. This should make it
possible to, among other things, drag and drop folders and files simultaneously
from and to sandboxed applications.
- Fallback to a hardcoded check to xdg-desktop-portal-gtk in the absence of any
other portal or configuration file, as a last resort mechanism.
- Various smaller fixes to the build system.
Released: 2024-10-09

- Completely rework and restructure the documentation website. Documentation is
now segmented by target audience (app developers, desktop developers, and
contributors). It also documents how the Document portal operates, the FUSE
filesystem, and custom file attributes. This is available in the following
address: https://flatpak.github.io/xdg-desktop-portal/docs/index.html
- The portals.conf parser is now able to handle fallback backends better, and
respects the order of backends in the config file.
- Try to use the xdg-desktop-portal-gtk backend as a last resort backend, if
everything else fails.
- Implement getlk and setlk, and honour O_NOFOLLOW, in the Document portal's
FUSE filesystem.
- Neutralize the Devices portal. Originally the Devices portal was introduced
so that services like PulseAudio or PipeWire could request access to
microphones and cameras on the behalf of apps. It was not meant to be used by
sandboxed apps directly, which is unusual for a portal. Practically, however,
it didn't take off.
- Implement PID/TID mapping for host system apps.
- Add a new "supported_output_file_formats" option to the Print portal. This
can be used by apps like browsers to limit the output file formats presented
by the Print portal backend. For example, an app can limit file printing to
PDF files.
- Add a new "GetHostPaths" method to the Document portal, which allows mapping
file descriptors to paths on the host system. This can be used by apps to
show more meaningful file paths in the user interface.
- Like the new method above, the Document portal sets the
"user.document-portal.host-path" xattr on files, pointing to the the host
system file path. The use case is similar to "GetHostPaths".
- Make the Background portal more robust when validating autostart files.
- Clarify behavior of the File Chooser portal in the documentation pages.
- Improve robustness against deleted o_path fds in the Document portal.
- Fix a warning in some systems while trying to load Request D-Bus object
properties.
- Fix a physical inode leak in the Document portal.
- Various improvements to the test suite. Python-based tests now run in parallel
and are more careful when setting up the mock D-Bus server. Tests also start
dbus-monitor if necessary now. FUSE tests of the Document portal have been
made more TAP-alike now.
- Memory leak fixes in a variety of portals and services, including the
permissions database, the Document portal, the File Transfer portal, the
Location portal, the Background portal, tests, and the icon validator. And
more. There's a lot of memory leak fixes everywhere, really.
- Major refactorings of the icon validator. Icons are now limited to 4MB files.
- Update XML specification specifying session handle type to match current
actual ABI in GlobalShortcuts, Inhibit, RemoteDesktop, and ScreenCast portals.
- New and updated translations.

Changes in 1.18.1
=================
Expand Down
Loading
Loading