This commit is contained in:
Manav Rathi 2024-04-12 10:00:04 +05:30
parent aace18aba0
commit 664cf2157b
No known key found for this signature in database
2 changed files with 9 additions and 13 deletions

View file

@ -69,9 +69,7 @@ export const rendererURL = "next://app";
* For more details, see this comparison:
* https://github.com/HaNdTriX/next-electron-server/issues/5
*/
const setupRendererServer = () => {
serveNextAt(rendererURL);
};
const setupRendererServer = () => serveNextAt(rendererURL);
/**
* Log a standard startup banner.
@ -111,13 +109,16 @@ const increaseDiskCache = () => {
);
};
/**
* Hide the dock icon on macOS if the user wants it hidden and we were
* auto-launched on login.
*/
const hideDockIconIfNeeded = async () => {
if (process.platform != "darwin") return;
const shouldHideDockIcon = userPreferences.get("hideDockIcon");
const wasAutoLaunched = await autoLauncher.wasAutoLaunched();
if (process.platform == "darwin" && shouldHideDockIcon && wasAutoLaunched) {
app.dock.hide();
}
if (shouldHideDockIcon && wasAutoLaunched) app.dock.hide();
};
/**
@ -176,9 +177,7 @@ const main = () => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
mainWindow.show();
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
});

View file

@ -5,11 +5,8 @@ import { isAppQuitting, rendererURL } from "../main";
import log from "./log";
import { createTrayContextMenu } from "./menu";
import autoLauncher from "./services/autoLauncher";
import { getHideDockIconPreference } from "./services/userPreference";
import { isDev } from "./util";
/**
* Create an return the {@link BrowserWindow} that will form our app's UI.
*