From 33c869edaea5ef57874d70ab9d640047958872ae Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Thu, 6 Feb 2020 06:19:20 -0500 Subject: [PATCH] [MM-22193] Workaround for app hang on Windows 10 dark mode (#1180) --- src/main.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main.js b/src/main.js index ef4dcd5a..ae73927b 100644 --- a/src/main.js +++ b/src/main.js @@ -4,6 +4,7 @@ import os from 'os'; import path from 'path'; +import fs from 'fs'; import electron from 'electron'; import isDev from 'electron-is-dev'; @@ -601,6 +602,20 @@ function initializeAfterAppReady() { catch((err) => console.log('An error occurred: ', err)); } + // Workaround for MM-22193 + // From this post: https://github.com/electron/electron/issues/19468#issuecomment-549593139 + // Electron 6 has a bug that affects users on Windows 10 using dark mode, causing the app to hang + // This workaround deletes a file that stops that from happening + if (process.platform === 'win32') { + const appUserDataPath = app.getPath('userData'); + const devToolsExtensionsPath = path.join(appUserDataPath, 'DevTools Extensions'); + try { + fs.unlinkSync(devToolsExtensionsPath); + } catch (_) { + // don't complain if the file doesn't exist + } + } + // Protocol handler for win32 if (process.platform === 'win32') { const args = process.argv.slice(1);