diff --git a/src/app/window-utils.ts b/src/app/window-utils.ts index ec7ab5b3..080f3e1c 100644 --- a/src/app/window-utils.ts +++ b/src/app/window-utils.ts @@ -32,6 +32,7 @@ import { screenSnippet } from './screen-snippet-handler'; import { updateAlwaysOnTop } from './window-actions'; import { ICustomBrowserWindow, windowHandler } from './window-handler'; +import { notification } from '../renderer/notification'; interface IStyles { name: styleNames; content: string; @@ -293,6 +294,9 @@ export const updateLocale = async (locale: LocaleType): Promise => { appMenu.update(locale); } + // Update notification after new locale + notification.cleanUpInactiveNotification(); + if (i18n.isValidLocale(locale)) { // Update user config file with latest locale changes await config.updateUserConfig({ locale }); diff --git a/src/renderer/notification.ts b/src/renderer/notification.ts index 73f48e08..915a403b 100644 --- a/src/renderer/notification.ts +++ b/src/renderer/notification.ts @@ -427,6 +427,25 @@ class Notification extends NotificationHandler { this.inactiveWindows = []; } + /** + * Closes the active notification after certain period + */ + public cleanUpInactiveNotification() { + if (this.inactiveWindows.length > 0) { + logger.info('notification: cleaning up inactive notification windows', { + inactiveNotification: this.inactiveWindows.length, + }); + this.inactiveWindows.forEach((window) => { + if (windowExists(window)) { + window.close(); + } + }); + logger.info(`notification: cleaned up inactive notification windows`, { + inactiveNotification: this.inactiveWindows.length, + }); + } + } + /** * Brings all the notification to the top * issue: ELECTRON-1382 @@ -508,25 +527,6 @@ class Notification extends NotificationHandler { this.activeNotifications.push(notificationWindow); } - /** - * Closes the active notification after certain period - */ - private cleanUpInactiveNotification() { - if (this.inactiveWindows.length > 0) { - logger.info('notification: cleaning up inactive notification windows', { - inactiveNotification: this.inactiveWindows.length, - }); - this.inactiveWindows.forEach((window) => { - if (windowExists(window)) { - window.close(); - } - }); - logger.info(`notification: cleaned up inactive notification windows`, { - inactiveNotification: this.inactiveWindows.length, - }); - } - } - /** * Clears the timer for a specific notification window *