diff --git a/docs/api/environment-variables.md b/docs/api/environment-variables.md index f6b05c4cf85c..c033676a5915 100644 --- a/docs/api/environment-variables.md +++ b/docs/api/environment-variables.md @@ -186,14 +186,3 @@ the one downloaded by `npm install`. Usage: ```sh export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing ``` - -## Set By Electron - -Electron sets some variables in your environment at runtime. - -### `ORIGINAL_XDG_CURRENT_DESKTOP` - -This variable is set to the value of `XDG_CURRENT_DESKTOP` that your application -originally launched with. Electron sometimes modifies the value of `XDG_CURRENT_DESKTOP` -to affect other logic within Chromium so if you want access to the _original_ value -you should look up this environment variable instead. diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md index 05e8bec2f144..32538c0381fc 100644 --- a/docs/breaking-changes.md +++ b/docs/breaking-changes.md @@ -16,9 +16,15 @@ This document uses the following convention to categorize breaking changes: ### Removed: `ELECTRON_OZONE_PLATFORM_HINT` environment variable -The default value of the `--ozone-plaftform` flag [changed to `auto`](https://chromium-review.googlesource.com/c/chromium/src/+/6775426). +The default value of the `--ozone-platform` flag [changed to `auto`](https://chromium-review.googlesource.com/c/chromium/src/+/6775426). -You should use the `XDG_SESSION_TYPE=wayland` environment variable instead to use Wayland. +Electron now defaults to running as a native Wayland app when launched in a Wayland session (when `XDG_SESSION_TYPE=wayland`). +Users can force XWayland by passing `--ozone-platform=x11`. + +### Removed: `ORIGINAL_XDG_CURRENT_DESKTOP` environment variable + +Previously, Electron changed the value of `XDG_CURRENT_DESKTOP` internally to `Unity`, and stored the original name of the desktop session +in a separate variable. `XDG_CURRENT_DESKTOP` is no longer overriden and now reflects the actual desktop environment. ### Removed: macOS 11 support diff --git a/lib/browser/init.ts b/lib/browser/init.ts index 0b9b225884f0..35cf6f832561 100644 --- a/lib/browser/init.ts +++ b/lib/browser/init.ts @@ -162,27 +162,6 @@ require('@electron/internal/browser/api/web-contents-view'); // Set main startup script of the app. const mainStartupScript = packageJson.main || 'index.js'; -const KNOWN_XDG_DESKTOP_VALUES = new Set(['Pantheon', 'Unity:Unity7', 'pop:GNOME']); - -function currentPlatformSupportsAppIndicator () { - if (process.platform !== 'linux') return false; - const currentDesktop = process.env.XDG_CURRENT_DESKTOP; - - if (!currentDesktop) return false; - if (KNOWN_XDG_DESKTOP_VALUES.has(currentDesktop)) return true; - // ubuntu based or derived session (default ubuntu one, communitheme…) supports - // indicator too. - if (/ubuntu/ig.test(currentDesktop)) return true; - - return false; -} - -// Workaround for electron/electron#5050 and electron/electron#9046 -process.env.ORIGINAL_XDG_CURRENT_DESKTOP = process.env.XDG_CURRENT_DESKTOP; -if (currentPlatformSupportsAppIndicator()) { - process.env.XDG_CURRENT_DESKTOP = 'Unity'; -} - // Quit when all windows are closed and no other one is listening to this. app.on('window-all-closed', () => { if (app.listenerCount('window-all-closed') === 1) { diff --git a/shell/common/platform_util_linux.cc b/shell/common/platform_util_linux.cc index d0f6ca904b12..b5cedcff0ad3 100644 --- a/shell/common/platform_util_linux.cc +++ b/shell/common/platform_util_linux.cc @@ -15,7 +15,6 @@ #include "base/cancelable_callback.h" #include "base/containers/contains.h" -#include "base/containers/map_util.h" #include "base/environment.h" #include "base/files/file_util.h" #include "base/files/scoped_file.h" @@ -59,8 +58,6 @@ const char kFreedesktopPortalName[] = "org.freedesktop.portal.Desktop"; const char kFreedesktopPortalPath[] = "/org/freedesktop/portal/desktop"; const char kFreedesktopPortalOpenURI[] = "org.freedesktop.portal.OpenURI"; -const char kOriginalXdgCurrentDesktopEnvVar[] = "ORIGINAL_XDG_CURRENT_DESKTOP"; - const char kMethodOpenDirectory[] = "OpenDirectory"; class ShowItemHelper { @@ -279,12 +276,6 @@ bool XDGUtil(const std::vector& argv, base::nix::CreateLaunchOptionsWithXdgActivation(base::BindOnce( [](base::RepeatingClosure quit_loop, base::LaunchOptions* options_out, base::LaunchOptions options) { - // Correct the XDG_CURRENT_DESKTOP environment variable before calling - // XDG, in case it was changed for compatibility. - if (const auto* orig = base::FindOrNull( - options.environment, kOriginalXdgCurrentDesktopEnvVar)) - options.environment.emplace(base::nix::kXdgCurrentDesktopEnvVar, - *orig); *options_out = std::move(options); std::move(quit_loop).Run(); },