Skip to content

Build your personal knowledge base with Trilium Notes

send global shortcut to current window, not the first one

contributor44b34d1ea01a
diff --git a/apps/server/src/services/window.ts b/apps/server/src/services/window.ts
index 459ebdf59d..cb047dba4b 100644
--- a/apps/server/src/services/window.ts
+++ b/apps/server/src/services/window.ts
@@ -337,14 +337,15 @@ async function registerGlobalShortcuts() {
const result = globalShortcut.register(
translatedShortcut,
cls.wrap(() => {
- if (!mainWindow) {
+ const targetWindow = getLastFocusedWindow() || mainWindow;
+ if (!targetWindow) {
return;
}
// window may be hidden / not in focus
- mainWindow.focus();
+ targetWindow.focus();
- mainWindow.webContents.send("globalShortcut", action.actionName);
+ targetWindow.webContents.send("globalShortcut", action.actionName);
})
);