#1128889 sway should start graphical-session.target for newer xdg-desktop-portal

Package:
sway
Source:
sway
Description:
i3-compatible Wayland compositor
Submitter:
Matthew Ruffell
Date:
2026-04-25 10:25:02 UTC
Severity:
normal
#1128889#5
Date:
2026-02-24 02:34:52 UTC
From:
To:
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Dear Maintainer,

There is trouble with xdg-desktop-portal once again.

xdg-desktop-portal recently updated from 1.20.3+ds-1 to 1.21.0+ds-1, and with
it brought:

commit 4d284de29d1d0740c9b80b634631a8f253287680
From: Jonas Ådahl <jadahl@gmail.com>
Date: Tue, 7 Oct 2025 10:25:59 +0200
Subject: Launch service after graphical session
Link: https://github.com/flatpak/xdg-desktop-portal/commit/4d284de29d1d0740c9b80b634631a8f253287680

This changes xdg-desktop-portal to only start after graphical-session.target.

After I installed 1.21.0+ds-1, waybar and mako would no longer start on sway.

Starting waybar or mako manually would bring:

dbus-daemon[8216]: [session uid=60578 pid=8216 pidfd=5] Activating via systemd: service name='org.freedesktop.portal.Desktop'  unit='xdg-desktop-portal.service' requested by ':1.24' (uid=1000 pid=6162 comm="waybar --bar main-bar --log-level error --config /" label="unconfined")
...
systemd[5956]: Dependency failed for xdg-desktop-portal.service - Portal service.
systemd[5956]: xdg-desktop-portal.service: Job xdg-desktop-portal.service/start failed with result 'dependency'.
...
/usr/libexec/gdm-wayland-session[6434]: [2026-02-20 10:16:49.619] [error] Error calling StartServiceByName for org.freedesktop.portal.Desktop:Timeout was reached
dbus-daemon[5979]: [session uid=1000 pid=5979 pidfd=5] Failed to activate service 'org.freedesktop.portal.Desktop': timed out (service_start_timeout=120000ms)

Currently, sway does not start graphical-session.target, so waybar and mako
user sessions do not start, but with this new change to xdg-desktop-portal,
makes starting waybar and mako impossible. waybar dbus activates
xdg-desktop-portal and waits for it to come on the bus, but the service never
starts and waybar gets stuck.

I think it is time to follow the rest of the wiki:

https://github.com/swaywm/sway/wiki/Systemd-integration#managing-user-applications-with-systemd

and implement /etc/systemd/user/sway-session.target to start
graphical-session.target, and have d/config.d/50-systemd-user.conf to start and
stop sway-session.target.

[Unit]
Description=sway compositor session
Documentation=man:systemd.special(7)
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target

I have made and tested the below debdiff that implements this, if you could
please consider if this is the way forward or not.

Thanks,
Matthew

diff -Nru sway-1.11/debian/changelog sway-1.11/debian/changelog
--- sway-1.11/debian/changelog	2025-10-06 07:07:19.000000000 +1300
+++ sway-1.11/debian/changelog	2026-02-24 12:16:13.000000000 +1300
@@ -1,3 +1,11 @@
+sway (1.11-4) UNRELEASED; urgency=medium
+
+  * d/sway-session.target: Add systemd target file
+  * d/config.d/50-systemd-user.conf: Start and stop systemd target
+    Closes: #<number>
+
+ -- Matthew Ruffell <matthew.ruffell@canonical.com>  Tue, 24 Feb 2026 12:16:13 +1300
+
 sway (1.11-3) unstable; urgency=medium

   [ Diederik de Haas ]
diff -Nru sway-1.11/debian/config.d/50-systemd-user.conf sway-1.11/debian/config.d/50-systemd-user.conf
--- sway-1.11/debian/config.d/50-systemd-user.conf	2025-10-06 07:07:19.000000000 +1300
+++ sway-1.11/debian/config.d/50-systemd-user.conf	2026-02-24 12:16:13.000000000 +1300
@@ -2,8 +2,11 @@
 # based on the instructions in the sway wiki
 # see also https://github.com/swaywm/sway/issues/5732
 # and https://github.com/systemd/systemd/blob/dfc637d0ff756889e8e5b7cb4ec991eb06069aa1/xorg/50-systemd-user.sh
+# additionally, start and stop systemd target on demand

#1128889#10
Date:
2026-04-25 10:13:37 UTC
From:
To:
https://github.com/swaywm/sway/pull/5622

In it it mentions the above referenced wiki entry, a sway-systemd project
(https://github.com/alebastr/sway-systemd) which seems to be used by Fedora.
And then there's https://github.com/OctopusET/sway-contrib/

It gives the impression of being some random (person's) repo, but apparently
it's a/the community maintained stuff of what was previously in sway's
'contrib' dir. In that repo, you can find the following:
https://github.com/OctopusET/sway-contrib/blob/master/sway-session.target
which is pretty much the same as the 'Unit' quoted above.

This repo is packaged by more distros ... including Debian:
https://tracker.debian.org/pkg/sway-contrib

It currently only has 'grimshot' and the package description also only mentions
that, but it seems to me that shipping 'sway-session.target' should happen in
the sway-contrib package. I'll leave it up to the maintainer (or you) to
actually reassign this bug to that package.

FWIW: A '+1' from me for shipping that file as I got a 'dependency error'
(too) when trying to use waybar.