diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index 20c632ec4ac..c4e345edf2e 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -215,6 +215,7 @@ export class Main { this.desktopSettingsService, this.messagingService, this.biometricsService, + this.logService, ); messageSubject.asObservable().subscribe((message) => { @@ -246,6 +247,7 @@ export class Main { this.desktopSettingsService, this.messagingService, this.biometricsService, + this.logService, ); this.desktopCredentialStorageListener = new DesktopCredentialStorageListener( @@ -309,7 +311,10 @@ export class Main { }, ]); if (await firstValueFrom(this.desktopSettingsService.startToTray$)) { + this.logService.info("startToTray is enabled"); await this.trayMain.hideToTray(); + } else { + this.logService.info("startToTray is not enabled"); } this.powerMonitorMain.init(); await this.updaterMain.init(); diff --git a/apps/desktop/src/main/tray.main.ts b/apps/desktop/src/main/tray.main.ts index b7ddefe6e1b..12db96792e3 100644 --- a/apps/desktop/src/main/tray.main.ts +++ b/apps/desktop/src/main/tray.main.ts @@ -6,6 +6,7 @@ import { app, BrowserWindow, Menu, MenuItemConstructorOptions, nativeImage, Tray import { firstValueFrom } from "rxjs"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; +import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { BiometricsService } from "@bitwarden/key-management"; @@ -28,6 +29,7 @@ export class TrayMain { private desktopSettingsService: DesktopSettingsService, private messagingService: MessagingService, private biometricService: BiometricsService, + private logService: LogService, ) { if (process.platform === "win32") { this.icon = path.join(__dirname, "/images/icon.ico"); @@ -119,9 +121,13 @@ export class TrayMain { } async hideToTray() { + this.logService.info("In hideToTray"); this.showTray(); + this.logService.info("After showTray"); if (this.windowMain.win != null) { + this.logService.info("Hiding window"); this.windowMain.win.hide(); + this.logService.info("After hiding window"); } if (this.isDarwin() && !(await firstValueFrom(this.desktopSettingsService.alwaysShowDock$))) { this.hideDock();