diff --git a/user/blueman-applet.service b/user/blueman-applet.service index f7d187b..d386d24 100644 --- a/user/blueman-applet.service +++ b/user/blueman-applet.service @@ -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 diff --git a/user/gcr-prompter.service b/user/gcr-prompter.service new file mode 100644 index 0000000..cf8a773 --- /dev/null +++ b/user/gcr-prompter.service @@ -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 + diff --git a/user/gnome-keyring-session.service b/user/gnome-keyring-session.service new file mode 100644 index 0000000..d3dd330 --- /dev/null +++ b/user/gnome-keyring-session.service @@ -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 + diff --git a/user/mango-session.target b/user/mango-session.target new file mode 100644 index 0000000..2d59c93 --- /dev/null +++ b/user/mango-session.target @@ -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 + diff --git a/user/mango-session.target.wants/blueman-applet.service b/user/mango-session.target.wants/blueman-applet.service new file mode 120000 index 0000000..0cfc68f --- /dev/null +++ b/user/mango-session.target.wants/blueman-applet.service @@ -0,0 +1 @@ +/home/ray/.config/systemd/user/blueman-applet.service \ No newline at end of file diff --git a/user/mango-session.target.wants/gcr-prompter.service b/user/mango-session.target.wants/gcr-prompter.service new file mode 120000 index 0000000..100a249 --- /dev/null +++ b/user/mango-session.target.wants/gcr-prompter.service @@ -0,0 +1 @@ +/home/ray/.config/systemd/user/gcr-prompter.service \ No newline at end of file diff --git a/user/mango-session.target.wants/gnome-keyring-session.service b/user/mango-session.target.wants/gnome-keyring-session.service new file mode 120000 index 0000000..733f864 --- /dev/null +++ b/user/mango-session.target.wants/gnome-keyring-session.service @@ -0,0 +1 @@ +/home/ray/.config/systemd/user/gnome-keyring-session.service \ No newline at end of file diff --git a/user/mango-session.target.wants/polkit-gnome-agent.service b/user/mango-session.target.wants/polkit-gnome-agent.service new file mode 120000 index 0000000..97ca885 --- /dev/null +++ b/user/mango-session.target.wants/polkit-gnome-agent.service @@ -0,0 +1 @@ +/home/ray/.config/systemd/user/polkit-gnome-agent.service \ No newline at end of file diff --git a/user/mango-session.target.wants/swww.service b/user/mango-session.target.wants/swww.service new file mode 120000 index 0000000..3be43ae --- /dev/null +++ b/user/mango-session.target.wants/swww.service @@ -0,0 +1 @@ +/home/ray/.config/systemd/user/swww.service \ No newline at end of file diff --git a/user/mango-session.target.wants/waybar.service b/user/mango-session.target.wants/waybar.service new file mode 120000 index 0000000..1ae7133 --- /dev/null +++ b/user/mango-session.target.wants/waybar.service @@ -0,0 +1 @@ +/home/ray/.config/systemd/user/waybar.service \ No newline at end of file diff --git a/user/polkit-gnome-agent.service b/user/polkit-gnome-agent.service new file mode 100644 index 0000000..b174be0 --- /dev/null +++ b/user/polkit-gnome-agent.service @@ -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 + diff --git a/user/swww.service b/user/swww.service index 78b12eb..fc18410 100644 --- a/user/swww.service +++ b/user/swww.service @@ -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 diff --git a/user/waybar.service b/user/waybar.service index 3db680c..f635900 100644 --- a/user/waybar.service +++ b/user/waybar.service @@ -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 diff --git a/user/ydotoold.service b/user/ydotoold.service new file mode 100644 index 0000000..60a5d14 --- /dev/null +++ b/user/ydotoold.service @@ -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