diff --git a/electron-projects/ucap-webmessenger-electron-core/src/lib/types/channel.type.ts b/electron-projects/ucap-webmessenger-electron-core/src/lib/types/channel.type.ts index aab87d73..d9f55c52 100644 --- a/electron-projects/ucap-webmessenger-electron-core/src/lib/types/channel.type.ts +++ b/electron-projects/ucap-webmessenger-electron-core/src/lib/types/channel.type.ts @@ -26,7 +26,8 @@ export enum ElectronBrowserWindowChannel { Show = 'show', Close = 'close', Closed = 'closed', - ReadyToShow = 'ready-to-show' + ReadyToShow = 'ready-to-show', + Focus = 'focus' } export enum ElectronWebContentsChannel { diff --git a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts index db325595..ab45380d 100644 --- a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts +++ b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts @@ -65,7 +65,7 @@ export class AppWindow { this.window = new BrowserWindow(windowOptions); savedWindowState.manage(this.window); - let quitting = false; + let quitting = true; app.on(ElectronAppChannel.BeforeQuit, () => { quitting = true; }); @@ -92,10 +92,14 @@ export class AppWindow { } }); this.window.on(ElectronBrowserWindowChannel.Close, e => { - if (!quitting) { - e.preventDefault(); - this.window.hide(); - } + // if (!quitting) { + e.preventDefault(); + this.window.hide(); + // } + }); + this.window.on(ElectronBrowserWindowChannel.Focus, e => { + console.log(e); + this.window.flashFrame(false); }); } diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index b5c5bf95..cc623dac 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -350,6 +350,7 @@ ipcMain.on( ) : '', onClick: e => { + appWindow.browserWindow.flashFrame(false); appWindow.browserWindow.webContents.send( ChatChannel.OpenRoom, noti.roomSeq @@ -358,12 +359,15 @@ ipcMain.on( e.close(); } }); + + appWindow.browserWindow.flashFrame(true); } ); ipcMain.on( NotificationChannel.CloseAllNotify, (event: IpcMainEvent, ...args: any[]) => { + appWindow.browserWindow.flashFrame(false); console.log('Channel.closeAllNotify', args); } );