create mango-session.target

This commit is contained in:
Ray Elliott 2026-03-04 19:58:39 +00:00
parent 207dac004e
commit e7b71de3d8
14 changed files with 137 additions and 8 deletions

View File

@ -1,5 +1,10 @@
# Blueman is attached to mango-session.target so it does not start during
# early default.target boot, where WAYLAND_DISPLAY may be missing and start-pre
# can hang until timeout.
[Unit]
Description=Blueman Applet
StartLimitIntervalSec=0
PartOf=mango-session.target
[Service]
Type=simple
@ -7,7 +12,6 @@ ExecStartPre=/usr/bin/sh -c 'until [ -n "$WAYLAND_DISPLAY" ] && [ -S "$XDG_RUNTI
ExecStart=/usr/bin/blueman-applet
Restart=on-failure
RestartSec=2
StartLimitIntervalSec=0
[Install]
WantedBy=default.target
WantedBy=mango-session.target

21
user/gcr-prompter.service Normal file
View File

@ -0,0 +1,21 @@
# GCR prompter provides keyring prompt dialogs used by secret-service flows.
#
# Why this unit exists:
# - In compositor-only sessions this helper may not be auto-started.
# - Running it explicitly avoids missing prompt UI in keyring unlock paths.
#
# Why it is tied to mango-session.target:
# - It is a GUI helper and should follow the compositor session lifecycle.
[Unit]
Description=GCR Prompter
PartOf=mango-session.target
[Service]
Type=simple
ExecStart=/usr/lib/gcr-prompter
Restart=on-failure
RestartSec=2
[Install]
WantedBy=mango-session.target

View File

@ -0,0 +1,23 @@
# gnome-keyring daemon for secrets + ssh components in TTY-launched mango
# sessions where PAM/autostart integration may not be present.
#
# Why this unit exists:
# - Ensures Secret Service (org.freedesktop.secrets) is available at login.
# - Avoids browser startup delays caused by secret-service timeouts.
#
# Notes:
# - This runs in foreground so systemd can supervise it directly.
# - SSH agent socket is created under %t/keyring/ssh.
[Unit]
Description=GNOME Keyring Daemon (Mango Session)
PartOf=mango-session.target
[Service]
Type=simple
ExecStart=/usr/bin/gnome-keyring-daemon --foreground --components=secrets,ssh
Restart=on-failure
RestartSec=2
[Install]
WantedBy=mango-session.target

30
user/mango-session.target Normal file
View File

@ -0,0 +1,30 @@
# User target for GUI applets that must start only after mango has initialized
# a real Wayland session and exported session environment variables to
# systemd --user. We explicitly start this target from mango config once per
# login, which avoids the default.target race where WAYLAND_DISPLAY is not yet
# present in the user manager environment.
#
# Why this exists:
# - default.target starts too early for Wayland-dependent desktop applets
# - applets like waybar/swww/blueman then block in ExecStartPre and may timeout
# - starting one dedicated target after environment import is deterministic
#
# What depends on this:
# - waybar.service
# - swww.service
# - blueman-applet.service
#
# Start path:
# - mango exec-once runs:
# systemctl --user import-environment ...
# dbus-update-activation-environment --systemd ...
# systemctl --user start mango-session.target
#
# Stop path:
# - services are PartOf=mango-session.target, so stopping the target cleanly
# stops all attached applets.
[Unit]
Description=Mango Session Target
Documentation=man:systemd.target(5)
RefuseManualStop=no

View File

@ -0,0 +1 @@
/home/ray/.config/systemd/user/blueman-applet.service

View File

@ -0,0 +1 @@
/home/ray/.config/systemd/user/gcr-prompter.service

View File

@ -0,0 +1 @@
/home/ray/.config/systemd/user/gnome-keyring-session.service

View File

@ -0,0 +1 @@
/home/ray/.config/systemd/user/polkit-gnome-agent.service

View File

@ -0,0 +1 @@
/home/ray/.config/systemd/user/swww.service

View File

@ -0,0 +1 @@
/home/ray/.config/systemd/user/waybar.service

View File

@ -0,0 +1,24 @@
# Polkit authentication UI agent for non-DE Wayland sessions.
#
# Why this unit exists:
# - On WM/compositor-only sessions, no desktop environment may auto-start a
# polkit agent.
# - Without an agent, privilege prompts can fail to appear.
#
# Why it is tied to mango-session.target:
# - This agent is GUI session scoped and should only exist while the compositor
# session is active.
[Unit]
Description=Polkit GNOME Authentication Agent
PartOf=mango-session.target
[Service]
Type=simple
Environment=NO_AT_BRIDGE=1
ExecStart=/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
Restart=on-failure
RestartSec=2
[Install]
WantedBy=mango-session.target

View File

@ -1,14 +1,18 @@
# swww is attached to mango-session.target instead of default.target so it
# starts only after Wayland session environment has been imported into
# systemd --user by mango startup.
[Unit]
Description=swww wallpaper daemon
After=default.target
PartOf=default.target
PartOf=mango-session.target
[Service]
Type=simple
# Keep a small readiness gate to avoid connecting before the compositor socket
# exists. With the target-based startup this should pass immediately.
ExecStartPre=/usr/bin/sh -c 'until [ -n "$WAYLAND_DISPLAY" ] && [ -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; do sleep 0.2; done'
ExecStart=/usr/bin/swww-daemon
Restart=on-failure
RestartSec=1
[Install]
WantedBy=default.target
WantedBy=mango-session.target

View File

@ -1,15 +1,19 @@
# Waybar is attached to mango-session.target instead of default.target to avoid
# startup races in TTY-launched Wayland sessions. The target is started only
# after mango exports WAYLAND_DISPLAY/DBUS env into systemd --user.
[Unit]
Description=Waybar
Documentation=man:waybar(5)
After=default.target
PartOf=default.target
PartOf=mango-session.target
[Service]
Type=simple
# Guard against rare timing jitter: do not exec waybar until the compositor
# socket actually exists for the display advertised in user-manager env.
ExecStartPre=/usr/bin/sh -c 'until [ -n "$WAYLAND_DISPLAY" ] && [ -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; do sleep 0.2; done'
ExecStart=/usr/bin/waybar
Restart=on-failure
RestartSec=1
[Install]
WantedBy=default.target
WantedBy=mango-session.target

13
user/ydotoold.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=ydotool daemon
After=default.target
PartOf=default.target
[Service]
Type=simple
ExecStart=/usr/bin/ydotoold
Restart=on-failure
RestartSec=1
[Install]
WantedBy=default.target