aboutsummaryrefslogtreecommitdiff
path: root/src/patcher.ts
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-08-29 18:45:58 +0200
committerVendicated <vendicated@riseup.net>2022-08-29 18:45:58 +0200
commit1709ab61ef2138d350b3d45a3eba0d94d5adf0a1 (patch)
tree92cfba166ee58f268ac617197d462f4b4dab1af5 /src/patcher.ts
parent876e622f4f61a4aa229ad69782d374335c3d8d6b (diff)
downloadVencord-1709ab61ef2138d350b3d45a3eba0d94d5adf0a1.tar.gz
Vencord-1709ab61ef2138d350b3d45a3eba0d94d5adf0a1.tar.bz2
Vencord-1709ab61ef2138d350b3d45a3eba0d94d5adf0a1.zip
Fix NPE when opening DevTools
Diffstat (limited to 'src/patcher.ts')
-rw-r--r--src/patcher.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/patcher.ts b/src/patcher.ts
index 9fe3dd2..e991377 100644
--- a/src/patcher.ts
+++ b/src/patcher.ts
@@ -20,6 +20,10 @@ class BrowserWindow extends electron.BrowserWindow {
}
}
Object.assign(BrowserWindow, electron.BrowserWindow);
+// esbuild may rename our BrowserWindow, which leads to it being excluded
+// from getFocusedWindow(), so this is necessary
+// https://github.com/discord/electron/blob/13-x-y/lib/browser/api/browser-window.ts#L60-L62
+Object.defineProperty(BrowserWindow, "name", { value: "BrowserWindow", configurable: true });
// Replace electrons exports with our custom BrowserWindow
const electronPath = require.resolve("electron");