mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 00:19:04 +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
|
||||
if (targetWindow.isMinimized()) {
|
||||
targetWindow.restore();
|
||||
}
|
||||
targetWindow.show();
|
||||
targetWindow.focus();
|
||||
showAndFocusWindow(targetWindow);
|
||||
|
||||
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() {
|
||||
return mainWindow;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user