Fix Windows tray restore during recording

This commit is contained in:
webadderall
2026-04-05 23:23:16 +10:00
parent ec5b26ee92
commit 18812bda10
+35 -7
View File
@@ -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();
}
},
},