From 664cf2157ba94cd57bcbdd27ff3aa5a506bd0ea3 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 12 Apr 2024 10:00:04 +0530 Subject: [PATCH] Reword --- desktop/src/main.ts | 19 +++++++++---------- desktop/src/main/init.ts | 3 --- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/desktop/src/main.ts b/desktop/src/main.ts index ca8819402..81b6dda2d 100644 --- a/desktop/src/main.ts +++ b/desktop/src/main.ts @@ -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(); } }); diff --git a/desktop/src/main/init.ts b/desktop/src/main/init.ts index 0b73f35f9..4568aee66 100644 --- a/desktop/src/main/init.ts +++ b/desktop/src/main/init.ts @@ -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. *