Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

notification area hud open fix with small window open refactor

elevchyt4655e71ca500
diff --git a/electron/main.ts b/electron/main.ts
index 257e0b202..23bcc492a 100644
--- a/electron/main.ts
+++ b/electron/main.ts
@@ -70,6 +70,19 @@ function createWindow() {
mainWindow = createHudOverlayWindow();
}
+function showMainWindow() {
+ if (mainWindow && !mainWindow.isDestroyed()) {
+ if (mainWindow.isMinimized()) {
+ mainWindow.restore();
+ }
+ mainWindow.show();
+ mainWindow.focus();
+ return;
+ }
+
+ createWindow();
+}
+
function isEditorWindow(window: BrowserWindow) {
return window.webContents.getURL().includes("windowType=editor");
}
@@ -177,6 +190,12 @@ function setupApplicationMenu() {
function createTray() {
tray = new Tray(defaultTrayIcon);
+ tray.on("click", () => {
+ showMainWindow();
+ });
+ tray.on("double-click", () => {
+ showMainWindow();
+ });
}
function getTrayIcon(filename: string) {
@@ -208,11 +227,7 @@ function updateTrayMenu(recording: boolean = false) {
{
label: "Open",
click: () => {
- if (mainWindow && !mainWindow.isDestroyed()) {
- mainWindow.isMinimized() && mainWindow.restore();
- } else {
- createWindow();
- }
+ showMainWindow();
},
},
{
@@ -355,7 +370,7 @@ app.whenReady().then(async () => {
if (!tray) createTray();
updateTrayMenu(recording);
if (!recording) {
- if (mainWindow) mainWindow.restore();
+ showMainWindow();
}
},
);