Package: sway
Version: 1.11-3
Severity: normal

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 <[email protected]>
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 <[email protected]>  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
 
-exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK 
XDG_CURRENT_DESKTOP
+exec "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK 
XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target"
+
+exec swaymsg -t subscribe '["shutdown"]' && systemctl --user stop 
sway-session.target
 
 exec hash dbus-update-activation-environment 2>/dev/null && \
         dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY 
SWAYSOCK XDG_CURRENT_DESKTOP=sway
diff -Nru sway-1.11/debian/sway.install sway-1.11/debian/sway.install
--- sway-1.11/debian/sway.install       2025-10-06 07:07:19.000000000 +1300
+++ sway-1.11/debian/sway.install       2026-02-24 12:14:40.000000000 +1300
@@ -1,5 +1,6 @@
 debian/config.d/50-systemd-user.conf /etc/sway/config.d/
 debian/sway-portals.conf /usr/share/xdg-desktop-portal/
+debian/sway-session.target /etc/systemd/user/
 etc/sway
 usr/bin/sway*
 usr/share/bash-completion/completions/sway*
diff -Nru sway-1.11/debian/sway-session.target 
sway-1.11/debian/sway-session.target
--- sway-1.11/debian/sway-session.target        1970-01-01 12:00:00.000000000 
+1200
+++ sway-1.11/debian/sway-session.target        2026-02-24 12:13:49.000000000 
+1300
@@ -0,0 +1,6 @@
+[Unit]
+Description=sway compositor session
+Documentation=man:systemd.special(7)
+BindsTo=graphical-session.target
+Wants=graphical-session-pre.target
+After=graphical-session-pre.target

Reply via email to