Skip to content

Commit d69dd2a

Browse files
committed
handle toggleTray global shortcut differently from other global shortcuts #7730
1 parent 5dd21ac commit d69dd2a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

apps/server/src/services/window.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import optionService from "./options.js";
66
import log from "./log.js";
77
import sqlInit from "./sql_init.js";
88
import cls from "./cls.js";
9+
import { KeyboardActionNames } from "@triliumnext/commons";
910
import keyboardActionsService from "./keyboard_actions.js";
1011
import electron from "electron";
1112
import type { App, BrowserWindowConstructorOptions, BrowserWindow, WebContents, IpcMainEvent } from "electron";
@@ -319,6 +320,7 @@ function closeSetupWindow() {
319320
}
320321

321322
async function registerGlobalShortcuts() {
323+
const toggleTrayAction: KeyboardActionNames = "toggleTray";
322324
const { globalShortcut } = await import("electron");
323325

324326
await sqlInit.dbReady;
@@ -342,8 +344,11 @@ async function registerGlobalShortcuts() {
342344
return;
343345
}
344346

345-
// window may be hidden / not in focus
346-
showAndFocusWindow(targetWindow);
347+
if (action.actionName === toggleTrayAction) {
348+
targetWindow.focus();
349+
} else {
350+
showAndFocusWindow(targetWindow);
351+
}
347352

348353
targetWindow.webContents.send("globalShortcut", action.actionName);
349354
})

0 commit comments

Comments
 (0)