Skip to content

XDG Desktop Portal introduced a breaking change for GTK4 apps #3052

Description

@trigg

flatpak/xdg-desktop-portal#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions