Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Fix Windows tray restore during recording

webadderallbd7524ca04a1
diff --git a/electron/main.ts b/electron/main.ts
index f5f1b89f..8e5ee927 100644
--- a/electron/main.ts
+++ b/electron/main.ts
@@ -160,6 +160,29 @@ function getRecordingTrayIcon() {
return recordingTrayIcon;
}
+function showHudOverlayFromTray() {
+ const hud = getHudOverlayWindow();
+ if (!hud) {
+ return false;
+ }
+
+ if (hud.isMinimized()) {
+ hud.restore();
+ }
+
+ if (process.platform === "win32" && isHudOverlayMousePassthroughSupported()) {
+ hud.showInactive();
+ hud.moveTop();
+ reassertHudOverlayMouseState();
+ return true;
+ }
+
+ hud.show();
+ hud.moveTop();
+ hud.focus();
+ return true;
+}
+
ipcMain.on("set-has-unsaved-changes", (_event, hasChanges: boolean) => {
editorHasUnsavedChanges = hasChanges;
});
@@ -214,6 +237,7 @@ function focusOrCreateMainWindow() {
!isEditorWindow(mainWindow) &&
isHudOverlayMousePassthroughSupported()
) {
+ showHudOverlayFromTray();
return;
}
@@ -371,6 +395,7 @@ function setupApplicationMenu() {
function createTray() {
tray = new Tray(getDefaultTrayIcon());
tray.on("click", () => focusOrCreateMainWindow());
+ tray.on("double-click", () => focusOrCreateMainWindow());
}
function getPublicAssetPath(filename: string) {
@@ -582,6 +607,14 @@ function updateTrayMenu(recording: boolean = false) {
const trayToolTip = recording ? `Recording: ${selectedSourceName}` : "Recordly";
const menuTemplate = recording
? [
+ {
+ label: "Show Controls",
+ click: () => {
+ if (!showHudOverlayFromTray()) {
+ focusOrCreateMainWindow();
+ }
+ },
+ },
{
label: "Stop Recording",
click: () => {
@@ -595,13 +628,8 @@ function updateTrayMenu(recording: boolean = false) {
{
label: "Open",
click: () => {
- if (mainWindow && !mainWindow.isDestroyed()) {
- if (mainWindow.isMinimized()) mainWindow.restore();
- mainWindow.show();
- mainWindow.focus();
- mainWindow.moveTop();
- } else {
- createWindow();
+ if (!showHudOverlayFromTray()) {
+ focusOrCreateMainWindow();
}
},
},