Skip to content

Commit

Permalink
Add '--disable-overlay' cmdline option.
Browse files Browse the repository at this point in the history
The option will prevent the overlay from attaching to Among Us while
also disabling the workarounds that got the overlay's transparency working.

This for those who have trouble with CrewLink's overlay since the
'hidden' overlay setting within CrewLink doesn't completely
stop the overlay from attaching to Among Us.
  • Loading branch information
TheGreatMcPain committed Jan 17, 2021
1 parent 32c6fc9 commit eb28b9f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ const isDevelopment = process.env.NODE_ENV !== 'production';

let mainWindow: BrowserWindow | null = null;
let overlayWindow: BrowserWindow | null = null;
let disableOverlay: boolean = false;
let setTimeoutValue: number = 0;

if (app.commandLine.hasSwitch('disable-overlay')) {
disableOverlay = true;
} else {
if (process.platform === 'linux') {
setTimeoutValue = 1000;
}
}

app.commandLine.appendSwitch('disable-pinch');

Expand Down Expand Up @@ -124,7 +134,9 @@ function createOverlay() {
);
}
window.setIgnoreMouseEvents(true);
electronOverlayWindow.attachTo(window, 'Among Us');
if (!disableOverlay) {
electronOverlayWindow.attachTo(window, 'Among Us');
}

if (isDevelopment) {
// Force devtools into detached mode otherwise they are unusable
Expand Down Expand Up @@ -224,7 +236,10 @@ if (!gotTheLock) {
}
});

app.disableHardwareAcceleration();
// Only needed to get proper transparency for the overlay under Linux
if (!disableOverlay) {
app.disableHardwareAcceleration();
}

// create main BrowserWindow when electron is ready
app.whenReady().then(() => {
Expand All @@ -235,7 +250,7 @@ if (!gotTheLock) {
initializeIpcListeners(overlayWindow);
initializeIpcHandlers();
},
process.platform === 'linux' ? 1000 : 0
setTimeoutValue
)
});
}

0 comments on commit eb28b9f

Please sign in to comment.