mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-24 23:05:49 +00:00
Fix Windows tray restore during recording
This commit is contained in:
+35
-7
@@ -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();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user