Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/systemd-user/singularity-session.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Unit]
Description=Singularity Desktop session
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target
11 changes: 11 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,14 @@ install_data(
install_dir: get_option('datadir') / 'singularity' / 'labwc',
install_mode: 'rwxr-xr-x',
)

# BindsTo=graphical-session.target so starting it pulls the target in as a
# side effect -- graphical-session.target itself is systemd-hardened against
# direct manual start (RefuseManualStart), by design: it must be reached via
# a bound unit. singularity-desktop-session starts this unit; that is the
# only thing that makes every WantedBy=graphical-session.target unit (our
# own xdg-desktop-portal-singularity.service among them) launch at all.
install_data(
'config/systemd-user/singularity-session.target',
install_dir: get_option('prefix') / 'lib' / 'systemd' / 'user',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Install the target into a systemd user-unit search path

For the advertised /opt/local installation, this places the target in /opt/local/lib/systemd/user, so the new systemctl call cannot find it and silently continues without activating the graphical services. Checked with systemd-analyze --user unit-paths: the standard paths include /usr/local/lib/systemd/user and /usr/lib/systemd/user, but not arbitrary ${prefix}/lib/systemd/user; use the configured systemd user-unit directory or otherwise install the file into a searched location.

Useful? React with 👍 / 👎.

)
22 changes: 22 additions & 0 deletions src/singularity-desktop-session
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,28 @@ nohup "$BIN/singularity-polkit-agent" >> "$_STATE/polkit.log" 2>&1 &
if [ -x "$BIN/ush-broker" ]; then
nohup "$BIN/ush-broker" >> "$_STATE/ush-broker.log" 2>&1 &
fi
# Pull in graphical-session.target so every systemd --user unit declaring
# WantedBy=graphical-session.target actually launches: our own
# xdg-desktop-portal-singularity.service among them, plus foot-server.
# Without this the target sits permanently inactive and those units never
# start at all, regardless of anything the portal ROUTER does below --
# confirmed live on O6N 2026-08-27: xdg-desktop-portal correctly resolved
# and routed Screenshot requests to the singularity backend (portals.conf
# staging from 2026-08-25 was working fine), but the backend process
# itself never started because nothing had ever started
# graphical-session.target on this system.
#
# graphical-session.target itself refuses direct manual start
# (systemd-hardened, RefuseManualStart) -- it must be reached via a unit
# that BindsTo= it. labwc ships labwc-session.target for exactly this
# (its own docs/autostart recommends starting it), but that unit is not
# actually installed by this build, so singularity-session.target
# (config/systemd-user/, installed by this repo's own meson.build) plays
# the same role: BindsTo=graphical-session.target,
# Wants=graphical-session-pre.target, so starting it gets the pre-target
# sequencing for free too.
systemctl --user --no-block start singularity-session.target 2>/dev/null || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop the session target when the compositor exits

When the user manager survives logout—such as with lingering enabled or another concurrent login—this start has no matching stop, so singularity-session.target remains active after labwc terminates. Because it keeps the StopWhenUnneeded=yes graphical target needed, graphical-session services such as the portal backend and foot server continue running outside the desktop session; add teardown tied to the launcher/compositor lifetime.

Useful? React with 👍 / 👎.


# Restart the portal so it picks up the live session environment, but do NOT
# block on it: xdg-desktop-portal can hang ~25s on its settings-proxy timeout
# waiting for our portal backend, which would delay the shell launch below.
Expand Down