Skip to content

Commit

Permalink
Revert GDK_BACKEND to work around Electron shell.openExternal bug.
Browse files Browse the repository at this point in the history
electron/electron#28436

Signed-off-by: Anders Kaseorg <anders@zulip.com>
  • Loading branch information
andersk committed Mar 30, 2021
1 parent d3401cc commit 78ae1b3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import * as ProxyUtil from './proxy-util';
import {_getServerSettings, _saveServerIcon, _isOnline} from './request';
import {setAutoLaunch} from './startup';

const {GDK_BACKEND} = process.env;

let mainWindowState: windowStateKeeper.State;

// Prevent window being garbage collected
Expand Down Expand Up @@ -159,6 +161,15 @@ app.on('activate', () => {
});

app.on('ready', () => {
if (process.env.GDK_BACKEND !== GDK_BACKEND) {
console.warn('Reverting GDK_BACKEND to work around https://github.com/electron/electron/issues/28436');
if (GDK_BACKEND === undefined) {
delete process.env.GDK_BACKEND;
} else {
process.env.GDK_BACKEND = GDK_BACKEND;
}
}

const ses = session.fromPartition('persist:webviewsession');
ses.setUserAgent(`ZulipElectron/${app.getVersion()} ${ses.getUserAgent()}`);

Expand Down

0 comments on commit 78ae1b3

Please sign in to comment.