Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sametcn99 committed May 14, 2024
1 parent 2c607fe commit 0123c72
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/app/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {
copyWidgetsDirIfNeeded,
createMainWindow,
createWindowsForWidgets,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
hotReloadWidgets,
displayControl,
windowManager,
} from "../../utils";
import "./ipc-operations/global";
import "./ipc-operations/app-operations";
Expand All @@ -38,12 +37,11 @@ app.whenReady().then(() => {
displayControl();
createWindowsForWidgets();
registerTray();
// hotReloadWidgets();
// app.on("activate", () => {
// if (BrowserWindow.getAllWindows().length === 0) {
// createMainWindow();
// }
// });
app.on("activate", () => {
if (windowManager.getAllWindows().length === 0) {
createMainWindow();
}
});
});

// Set the application to automatically start at login
Expand Down
10 changes: 10 additions & 0 deletions src/utils/browser-windows/window-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ class WindowManager {
}
}

getAllWindows(): BrowserWindow[] {
try {
return BrowserWindow.getAllWindows();
} catch (error) {
console.error("Error getting windows:", error);
dialog.showErrorBox("Error getting windows", `${error}`);
return [];
}
}

getAllWindowsExceptMain(): BrowserWindow[] {
try {
const windows: BrowserWindow[] = [];
Expand Down

0 comments on commit 0123c72

Please sign in to comment.