fix: Use XDG_ACTIVATION_TOKEN in wayland when launched by other app (#43546)

When an electron app is launched by another app ensure that the
XDG_ACTIVATION_TOKEN env var is read and used for activation using
xdg_activation_v1 protocol.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Orko Garai <orko@igalia.com>
This commit is contained in:
trop[bot] 2024-09-04 17:28:06 +02:00 committed by GitHub
parent 0ee624c308
commit 6172e1d2b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View file

@ -406,6 +406,11 @@ std::optional<int> ElectronMainDelegate::PreBrowserMain() {
content::InitializeMojoCore();
#if BUILDFLAG(IS_MAC)
RegisterAtomCrApp();
#endif
#if BUILDFLAG(IS_LINUX)
// Set the global activation token sent as an environment variable.
auto env = base::Environment::Create();
base::nix::ExtractXdgActivationTokenFromEnv(*env);
#endif
return std::nullopt;
}