# Chromium D-Bus singleton activation (future fork direction)Not started -- this is a write-up of a problem observed on this machine andthe shape a fix would take in a Chromium fork, kept here so the idea isn'tlost before anyone has time to act on it. There is no fork yet.## Symptom`flatpak run org.chromium.Chromium`, launched from KDE Plasma's taskmanager, appeared to hang indefinitely. What actually happened: the firstlaunch was slow to map its first window (cold profile/cache, GPU processinit). Re-clicking the launcher icon while waiting didn't focus/wait on thatin-progress launch -- it ran the `.desktop` file's `Exec=` line again. Thisrepeated a handful of times, producing five fully independent Chromiumprocess trees (each with its own zygote, GPU process, network/storageservice, and renderers) all fighting over the same CPU cores, disk cache,and `/dev/dri/renderD128`, which made every one of them even slower tostart -- compounding into what looked like a permanent hang.## Root causeTwo things stacked:1. **KDE's task manager has no way to know a launch is in flight** withoutthe freedesktop startup-notification protocol or an existing window tomatch against. With neither available yet, a second click isindistinguishable from a fresh launch request.2. **Chromium doesn't use D-Bus activation.** On Linux it implements its ownlegacy singleton check (a lock file + Unix domain socket handshake, see`chrome/browser/process_singleton_posix.cc` upstream) that predates`org.freedesktop.Application`. That handshake is timeout-based: if thealready-running instance doesn't answer fast enough (because it's stillstarting up, or because Flatpak's per-launch sandbox namespacing gets inthe way of the socket), the new process assumes there's no existinginstance and cold-starts a full second browser instead of forwarding the"open a window" request.Neither KDE nor Flatpak are missing a check they're supposed to runthemselves -- both already fully support the standard fix (D-Busactivation: `DBusActivatable=true` in the `.desktop` file + an`org.freedesktop.Application` implementation), and other well-behavedFlatpak apps get correct, invisible single-instance behavior for freethrough it. Chromium (and Electron apps generally) just never adopted thatcontract, because the existing singleton code is shared, cross-platformlogic that already works well enough on Windows/macOS without it.## Direction for a fork- Add a Linux-only `org.freedesktop.Application` implementation toChromium's browser-process startup, gated behind `BUILDFLAG(IS_LINUX)`(excluding ChromeOS), that responds to `Activate`/`Open` D-Bus calls thesame way the existing process-singleton IPC responds to a second launchtoday.- Ship a matching `<app-id>.service` file so `flatpak run` (or a nativedesktop launch) can be delivered via bus activation instead of alwaysexec'ing a fresh `chrome` binary; wire `DBusActivatable=true` into the`.desktop` file.- Keep the existing lock-file/socket mechanism as the fallback fornon-D-Bus environments (still needed for other embedders, e.g. CEF).- Flatpak manifest side: the sandbox needs `--own-name=<app-id>` (or theequivalent `finish-args`) for the bus name the service file activates, sothis doesn't depend on the fragile shared-socket path across sandboxnamespaces at all.## Why this is genuinely a fork, not just a patch to carryChromium's process-singleton code is shared across all desktop platforms;Linux-specific D-Bus activation is new surface area with its ownmaintenance cost, and upstream has historically been conservative aboutplatform-specific branches in that file. Realistic expectation: this staysa downstream patch (in the vein of what Vivaldi/Brave carry) rather thansomething likely to land upstream quickly, so plan for it to need rebasingacross Chromium version bumps.## Stopgap in use todayNo fork exists yet, so the actual fix on this machine is external toChromium: wrap the launcher's `Exec=` in an `flock`-guarded script so asecond launch blocks (or no-ops) on a lockfile instead of racing the firstinstance's cold start, and set `StartupNotify=true` /correct`StartupWMClass` on the `.desktop` file so KDE's task manager showsa busy state instead of silently permitting a duplicate launch.