mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 16:39:02 +01:00
add reusable showAndFocusWindow function
This commit is contained in:
parent
9a5f2f8d3b
commit
f629f564cd
@ -343,11 +343,7 @@ async function registerGlobalShortcuts() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// window may be hidden / not in focus
|
// window may be hidden / not in focus
|
||||||
if (targetWindow.isMinimized()) {
|
showAndFocusWindow(targetWindow);
|
||||||
targetWindow.restore();
|
|
||||||
}
|
|
||||||
targetWindow.show();
|
|
||||||
targetWindow.focus();
|
|
||||||
|
|
||||||
targetWindow.webContents.send("globalShortcut", action.actionName);
|
targetWindow.webContents.send("globalShortcut", action.actionName);
|
||||||
})
|
})
|
||||||
@ -363,6 +359,17 @@ async function registerGlobalShortcuts() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showAndFocusWindow(window: BrowserWindow) {
|
||||||
|
if (!window) return;
|
||||||
|
|
||||||
|
if (window.isMinimized()) {
|
||||||
|
window.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.show();
|
||||||
|
window.focus();
|
||||||
|
}
|
||||||
|
|
||||||
function getMainWindow() {
|
function getMainWindow() {
|
||||||
return mainWindow;
|
return mainWindow;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user