@@ -28,10 +28,10 @@ console.log("[Vencord] Starting up...");
2828// Our injector file at app/index.js
2929const injectorPath = require . main ! . filename ;
3030
31- // special discord_arch_electron injection method
31+ // Original Discord app.asar name
3232const asarName = require . main ! . path . endsWith ( "app.asar" ) ? "_app.asar" : "app.asar" ;
3333
34- // The original app.asar
34+ // Original Discord app.asar
3535const asarPath = join ( dirname ( injectorPath ) , ".." , asarName ) ;
3636
3737const discordPkg = require ( join ( asarPath , "package.json" ) ) ;
@@ -42,28 +42,29 @@ app.setAppPath(asarPath);
4242
4343if ( ! IS_VANILLA ) {
4444 const settings = RendererSettings . store ;
45- // Repatch after host updates on Windows
46- if ( process . platform === "win32" ) {
47- require ( "./patchWin32Updater" ) ;
48-
49- if ( settings . winCtrlQ ) {
50- const originalBuild = Menu . buildFromTemplate ;
51- Menu . buildFromTemplate = function ( template ) {
52- if ( template [ 0 ] ?. label === "&File" ) {
53- const { submenu } = template [ 0 ] ;
54- if ( Array . isArray ( submenu ) ) {
55- submenu . push ( {
56- label : "Quit (Hidden)" ,
57- visible : false ,
58- acceleratorWorksWhenHidden : true ,
59- accelerator : "Control+Q" ,
60- click : ( ) => app . quit ( )
61- } ) ;
62- }
45+
46+ // Repatch after host updates on Windows and Linux
47+ if ( process . platform === "win32" || process . platform === "linux" ) {
48+ require ( "./persistAfterDiscordUpdates" ) ;
49+ }
50+
51+ if ( process . platform === "win32" && settings . winCtrlQ ) {
52+ const originalBuild = Menu . buildFromTemplate ;
53+ Menu . buildFromTemplate = function ( template ) {
54+ if ( template [ 0 ] ?. label === "&File" ) {
55+ const { submenu } = template [ 0 ] ;
56+ if ( Array . isArray ( submenu ) ) {
57+ submenu . push ( {
58+ label : "Quit (Hidden)" ,
59+ visible : false ,
60+ acceleratorWorksWhenHidden : true ,
61+ accelerator : "Control+Q" ,
62+ click : ( ) => app . quit ( )
63+ } ) ;
6364 }
64- return originalBuild . call ( this , template ) ;
65- } ;
66- }
65+ }
66+ return originalBuild . call ( this , template ) ;
67+ } ;
6768 }
6869
6970 class BrowserWindow extends electron . BrowserWindow {
@@ -137,13 +138,11 @@ if (!IS_VANILLA) {
137138 process . env . DATA_DIR = join ( app . getPath ( "userData" ) , ".." , "Vencord" ) ;
138139
139140 // Monkey patch commandLine to:
140- // - disable WidgetLayering: Fix DevTools context menus https://github.com/electron/electron/issues/38790
141141 // - disable UseEcoQoSForBackgroundProcess: Work around Discord unloading when in background
142142 const originalAppend = app . commandLine . appendSwitch ;
143143 app . commandLine . appendSwitch = function ( ...args ) {
144144 if ( args [ 0 ] === "disable-features" ) {
145145 const disabledFeatures = new Set ( ( args [ 1 ] ?? "" ) . split ( "," ) ) ;
146- disabledFeatures . add ( "WidgetLayering" ) ;
147146 disabledFeatures . add ( "UseEcoQoSForBackgroundProcess" ) ;
148147 args [ 1 ] += [ ...disabledFeatures ] . join ( "," ) ;
149148 }
0 commit comments