From ac231eeb5413a226241b90b4b3337e65d84b0ec3 Mon Sep 17 00:00:00 2001 From: Gabriel Brown Date: Tue, 18 Aug 2026 21:35:31 -0400 Subject: [PATCH] Stop double-launching Nextcloud and Bitwarden at session start Both already have a ~/.config/autostart/*.desktop entry, and systemd's own xdg-autostart generator turns that into a graphical-session.target unit that fires on its own -- confirmed live via `systemctl --user list-units 'app-*@autostart.service'`. autostart.lua was also launching both explicitly, on the (apparently outdated) assumption that nothing else would. For Bitwarden this was actively harmful: each `flatpak run` gets its own sandbox instance, so the duplicate launch left two processes fighting over the app's single-instance lock, with neither reliably owning a usable window -- this is what "can't open Bitwarden" traced back to, alongside a live document-portal fuse mount that had silently died (fixed by restarting xdg-document-portal.service; not a config issue, so nothing to commit there). Claude-Session: https://claude.ai/code/session_01E6TJUAh41HaP25MVHWkhRZ --- config/dot/hypr/autostart.lua | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/config/dot/hypr/autostart.lua b/config/dot/hypr/autostart.lua index af3fc6e..c2a03a5 100644 --- a/config/dot/hypr/autostart.lua +++ b/config/dot/hypr/autostart.lua @@ -47,18 +47,22 @@ hl.on("hyprland.start", function() -- Keyring unlock, for Nextcloud and Bitwarden credential storage. hl.exec_cmd("/usr/bin/gnome-keyring-daemon --start --components=secrets,ssh,pkcs11") - -- Tray applications carried over from ~/.config/autostart. These need the - -- Quickshell tray (an SNI host) to be up, hence starting after it. + -- Nextcloud and Bitwarden are NOT started here. Both ship a + -- ~/.config/autostart/*.desktop entry, and systemd's own + -- systemd-xdg-autostart-generator turns every such entry into a + -- `PartOf=graphical-session.target` unit (`app-Nextcloud@autostart.service`, + -- `app-com.bitwarden.desktop@autostart.service`) that fires once the uwsm + -- session brings up graphical-session.target -- confirmed live via + -- `systemctl --user list-units 'app-*@autostart.service'`. An explicit + -- second launch here used to duplicate that: for Bitwarden specifically, + -- each `flatpak run` gets its own sandbox instance, so the two starts + -- didn't just race, they left two competing processes fighting over the + -- app's single-instance lock, with neither reliably owning a usable + -- window. Trust the generator instead of re-launching. -- - -- Commands are copied verbatim from the GNOME .desktop files rather than - -- guessed: Bitwarden is a flatpak with no `bitwarden` binary on PATH, and - -- its autostart entry launches a specific script with --autostart. - -- - -- RustDesk is deliberately absent: it ships an enabled *system* service - -- (`rustdesk --service`) that spawns --server and --tray for the session on - -- its own. Starting it here as well would give you two trays. - hl.exec_cmd("nextcloud --background") - hl.exec_cmd("flatpak run --command=bitwarden.sh com.bitwarden.desktop --autostart") + -- RustDesk is deliberately absent too: it ships an enabled *system* + -- service (`rustdesk --service`) that spawns --server and --tray for the + -- session on its own. Starting it here as well would give you two trays. end) hl.on("hyprland.shutdown", function()