This commit is contained in:
Manav Rathi 2024-04-12 10:28:23 +05:30
parent 87905a39f8
commit 98c3e43b70
No known key found for this signature in database
2 changed files with 5 additions and 11 deletions

View file

@ -19,7 +19,6 @@ import {
addAllowOriginHeader,
handleDownloads,
handleExternalLinks,
setupMacWindowOnDockIconClick,
} from "./main/init";
import { attachFSWatchIPCHandlers, attachIPCHandlers } from "./main/ipc";
import log, { initLogging } from "./main/log";
@ -243,7 +242,7 @@ const main = () => {
return;
}
let mainWindow: BrowserWindow;
let mainWindow: BrowserWindow | undefined;
initLogging();
setupRendererServer();
@ -266,7 +265,6 @@ const main = () => {
mainWindow = await createMainWindow();
const watcher = initWatcher(mainWindow);
setupTrayItem(mainWindow);
setupMacWindowOnDockIconClick();
Menu.setApplicationMenu(await createApplicationMenu(mainWindow));
attachIPCHandlers();
attachFSWatchIPCHandlers(watcher);
@ -284,6 +282,10 @@ const main = () => {
}
});
// This is a macOS only event. Show our window when the user activates the
// app, e.g. by clicking on its dock icon.
app.on("activate", () => mainWindow?.show());
app.on("before-quit", () => setIsAppQuitting(true));
};

View file

@ -42,14 +42,6 @@ export function getUniqueSavePath(filename: string, directory: string): string {
return uniqueFileSavePath;
}
export function setupMacWindowOnDockIconClick() {
app.on("activate", function () {
const windows = BrowserWindow.getAllWindows();
// we allow only one window
windows[0].show();
});
}
function lowerCaseHeaders(responseHeaders: Record<string, string[]>) {
const headers: Record<string, string[]> = {};
for (const key of Object.keys(responseHeaders)) {