check if was autoLaunched i.e launched at login instead of launched as hidden

This commit is contained in:
Abhinav 2022-09-03 16:17:23 +05:30
parent ac76588d29
commit c978eb9cf2
5 changed files with 10 additions and 9 deletions

View file

@ -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();
}
}

View file

@ -21,8 +21,8 @@ class LinuxAutoLauncher implements AutoLauncherClient {
}
}
async wasOpenedAsHidden() {
return this.isEnabled();
async wasAutoLaunched() {
return false;
}
private async disableAutoLaunch() {

View file

@ -12,8 +12,9 @@ class MacAndWindowsAutoLauncher implements AutoLauncherClient {
this.enableAutoLogin();
}
}
async wasOpenedAsHidden() {
return app.getLoginItemSettings().wasOpenedAsHidden;
async wasAutoLaunched() {
return app.getLoginItemSettings().wasOpenedAtLogin;
}
private disableAutoLogin() {

View file

@ -1,5 +1,5 @@
export interface AutoLauncherClient {
isEnabled: () => Promise<boolean>;
toggleAutoLaunch: () => Promise<void>;
wasOpenedAsHidden: () => Promise<boolean>;
wasAutoLaunched: () => Promise<boolean>;
}

View file

@ -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();
}
});