mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-08-29 10:09:26 +02:00
desktop: fix auto start with minimized window on macos
This commit is contained in:
@@ -92,6 +92,17 @@ async function createWindow() {
|
||||
const cliOptions = await parseArguments(process.argv);
|
||||
setTheme(getTheme());
|
||||
|
||||
// this workaround is necessary because macos doesn't support
|
||||
// the --hidden flag when launching the app on startup
|
||||
if (
|
||||
process.platform === "darwin" &&
|
||||
app.getLoginItemSettings().wasOpenedAtLogin &&
|
||||
config.desktopSettings.autoStart &&
|
||||
config.desktopSettings.startMinimized
|
||||
) {
|
||||
cliOptions.hidden = true;
|
||||
}
|
||||
|
||||
const mainWindowState = new WindowState({});
|
||||
const mainWindow = new BrowserWindow({
|
||||
show: !cliOptions.hidden,
|
||||
@@ -141,8 +152,13 @@ async function createWindow() {
|
||||
mainWindow.setMenuBarVisibility(false);
|
||||
mainWindowState.manage(mainWindow);
|
||||
|
||||
if (cliOptions.hidden && !(config.desktopSettings.minimizeToSystemTray
|
||||
|| config.desktopSettings.closeToSystemTray))
|
||||
if (
|
||||
cliOptions.hidden &&
|
||||
!(
|
||||
config.desktopSettings.minimizeToSystemTray ||
|
||||
config.desktopSettings.closeToSystemTray
|
||||
)
|
||||
)
|
||||
mainWindow.minimize();
|
||||
|
||||
await mainWindow.webContents.loadURL(`${createURL(cliOptions, "/")}`);
|
||||
|
||||
Reference in New Issue
Block a user