check if was autoLaunched i.e launched at login instead of launched as hidden
This commit is contained in:
parent
ac76588d29
commit
c978eb9cf2
|
@ -25,11 +25,11 @@ class AutoLauncher {
|
|||
await this.client.toggleAutoLaunch();
|
||||
}
|
||||
|
||||
wasOpenedAsHidden() {
|
||||
wasAutoLaunched() {
|
||||
if (!this.client) {
|
||||
this.init();
|
||||
}
|
||||
return this.client.wasOpenedAsHidden();
|
||||
return this.client.wasAutoLaunched();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ class LinuxAutoLauncher implements AutoLauncherClient {
|
|||
}
|
||||
}
|
||||
|
||||
async wasOpenedAsHidden() {
|
||||
return this.isEnabled();
|
||||
async wasAutoLaunched() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private async disableAutoLaunch() {
|
||||
|
|
|
@ -12,8 +12,9 @@ class MacAndWindowsAutoLauncher implements AutoLauncherClient {
|
|||
this.enableAutoLogin();
|
||||
}
|
||||
}
|
||||
async wasOpenedAsHidden() {
|
||||
return app.getLoginItemSettings().wasOpenedAsHidden;
|
||||
|
||||
async wasAutoLaunched() {
|
||||
return app.getLoginItemSettings().wasOpenedAtLogin;
|
||||
}
|
||||
|
||||
private disableAutoLogin() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export interface AutoLauncherClient {
|
||||
isEnabled: () => Promise<boolean>;
|
||||
toggleAutoLaunch: () => Promise<void>;
|
||||
wasOpenedAsHidden: () => Promise<boolean>;
|
||||
wasAutoLaunched: () => Promise<boolean>;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ export async function createWindow(): Promise<BrowserWindow> {
|
|||
height: 600,
|
||||
width: 800,
|
||||
transparent: true,
|
||||
show: !(await autoLauncher.wasOpenedAsHidden()),
|
||||
show: !(await autoLauncher.wasAutoLaunched()),
|
||||
});
|
||||
splash.maximize();
|
||||
|
||||
|
@ -54,7 +54,7 @@ export async function createWindow(): Promise<BrowserWindow> {
|
|||
});
|
||||
mainWindow.once('ready-to-show', async () => {
|
||||
splash.destroy();
|
||||
if (!(await autoLauncher.wasOpenedAsHidden())) {
|
||||
if (!(await autoLauncher.wasAutoLaunched())) {
|
||||
mainWindow.show();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue