XDG Desktop Portal introduced a breaking change for GTK4 apps
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.1k
- Forks
- 237
- Avg merge
- 1h 43m
- Merged PRs (30d)
- 1
Description
https://github.com/flatpak/xdg-desktop-portal/issues/1983
https://gitlab.archlinux.org/archlinux/packaging/packages/xdg-desktop-portal/-/work_items/4
Background
XDG-desktop-portal changed the contract for WMs and extra steps are required for xdg-desktop-portals to work. A bug report was raised, and this is a feature.
Short story
Advice for SystemD & Dbus users has been to have a section in config.ini to deal with dbus-update-activation-environment
aka
[autostart]
00_dbus = dbus-update-activation-environment --systemd WAYLAND_DISPLAY DISPLAY XAUTHORITY WAYFIRE_SOCKET XDG_CURRENT_DESKTOP=wayfire
This would ensure any services running had the correct DISPLAY & WAYLAND_DISPLAY env variables. But a race condition existed, any services started prior to this call would have various issues due to not having the correct variables.
So now xdg-desktop-portal set itself to Require graphical-session.target and it will constantly fail under most Wayland compositors. This fixed the issue for itself in Gnome/KDE but broke everyone else.
The Fix (Low effort but correct)
Short of creating a wayfire-session-manager, we should at least emulate one to keep graphical-session active.
systemctl --user edit --force --full wayfire-session.service
[Unit]
Description=Wayfire Dummy Session
BindsTo=graphical-session.target
After=graphical-session.target
[Service]
Type=oneshot
ExecStart=/bin/true
RemainAfterExit=yes
[Install]
WantedBy=graphical-session.target
and add to autostart
[autostart]
...
00_dbus = dbus-update-activation-environment --systemd WAYLAND_DISPLAY DISPLAY XAUTHORITY WAYFIRE_SOCKET XDG_CURRENT_DESKTOP=wayfire
session = systemctl --user start wayfire-session
The fix (incorrect & very easy)
systemctl --user edit xdg-desktop-portal
[Unit]
Description=Portal service
PartOf=graphical-session.target
Requires=dbus.service
After=dbus.service
After=graphical-session.target
[Service]
Type=dbus
BusName=org.freedesktop.portal.Desktop
ExecStart=/usr/lib/xdg-desktop-portal
Slice=session.slice
Less correct to edit the desktop portal, but will return function just fine
Why isn't this a PR?
I do not expect, @ammen99 , that you would care to add & ship this systemd/xdg specific service file. But something needs to happen to fix this, and in the meantime I'm giving users the information to deal with this, and an easy-ish fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no implementation files or tests; start by reviewing the existing config.ini [autostart] handling and the linked xdg-desktop-portal issue. Clarify which systemd and D-Bus behavior Wayfire should support, then verify that the chosen integration keeps the graphical session active and portals functional under Wayland.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop-dev, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100