Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: issue with opening unneeded window on action in macos

Ilian Sapundshievc045e8f598d2
diff --git a/src/main/main.ts b/src/main/main.ts
index a0a3720f9..b92bec09d 100644
--- a/src/main/main.ts
+++ b/src/main/main.ts
@@ -626,12 +626,15 @@ app.on('window-all-closed', () => {
app.on('activate', (event, hasVisibleWindows) => {
// console.log('Activate ' + hasVisibleWindows);
- event.preventDefault();
+ var windows = BrowserWindow.getAllWindows();
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
- // if (BrowserWindow.getAllWindows().length === 0) {
- // createWindow(appI18N);
- // }
+ if (windows.length === 0) {
+ createWindow(appI18N);
+ } else {
+ showApp();
+ }
+ event.preventDefault();
});
app.on('quit', () => {
@@ -675,11 +678,6 @@ app
);
}
createWindow(i18n);
- app.on('activate', () => {
- // On macOS it's common to re-create a window in the app when the
- // dock icon is clicked and there are no other windows open.
- if (mainWindow === null) createWindow(i18n);
- });
i18n.on('languageChanged', (lng) => {
try {