Skip to content

Commit 5990d34

Browse files
fix: leave behind the unmodified XDG_CURRENT_DESKTOP variable (electron#23553)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
1 parent d87c8a8 commit 5990d34

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/api/environment-variables.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,14 @@ the one downloaded by `npm install`. Usage:
123123
```sh
124124
export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Debug
125125
```
126+
127+
## Set By Electron
128+
129+
Electron sets some variables in your environment at runtime.
130+
131+
### `ORIGINAL_XDG_CURRENT_DESKTOP`
132+
133+
This variable is set to the value of `XDG_CURRENT_DESKTOP` that your application
134+
originally launched with. Electron sometimes modifies the value of `XDG_CURRENT_DESKTOP`
135+
to affect other logic within Chromium so if you want access to the _original_ value
136+
you should look up this environment variable instead.

lib/browser/init.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ function currentPlatformSupportsAppIndicator () {
178178
}
179179

180180
// Workaround for electron/electron#5050 and electron/electron#9046
181+
process.env.ORIGINAL_XDG_CURRENT_DESKTOP = process.env.XDG_CURRENT_DESKTOP;
181182
if (currentPlatformSupportsAppIndicator()) {
182183
process.env.XDG_CURRENT_DESKTOP = 'Unity';
183184
}

0 commit comments

Comments
 (0)