mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 10:58:58 +01:00
handle toggleTray global shortcut differently from other global shortcuts #7730
This commit is contained in:
parent
5dd21ac539
commit
d69dd2a83f
@ -6,6 +6,7 @@ import optionService from "./options.js";
|
|||||||
import log from "./log.js";
|
import log from "./log.js";
|
||||||
import sqlInit from "./sql_init.js";
|
import sqlInit from "./sql_init.js";
|
||||||
import cls from "./cls.js";
|
import cls from "./cls.js";
|
||||||
|
import { KeyboardActionNames } from "@triliumnext/commons";
|
||||||
import keyboardActionsService from "./keyboard_actions.js";
|
import keyboardActionsService from "./keyboard_actions.js";
|
||||||
import electron from "electron";
|
import electron from "electron";
|
||||||
import type { App, BrowserWindowConstructorOptions, BrowserWindow, WebContents, IpcMainEvent } from "electron";
|
import type { App, BrowserWindowConstructorOptions, BrowserWindow, WebContents, IpcMainEvent } from "electron";
|
||||||
@ -319,6 +320,7 @@ function closeSetupWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function registerGlobalShortcuts() {
|
async function registerGlobalShortcuts() {
|
||||||
|
const toggleTrayAction: KeyboardActionNames = "toggleTray";
|
||||||
const { globalShortcut } = await import("electron");
|
const { globalShortcut } = await import("electron");
|
||||||
|
|
||||||
await sqlInit.dbReady;
|
await sqlInit.dbReady;
|
||||||
@ -342,8 +344,11 @@ async function registerGlobalShortcuts() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// window may be hidden / not in focus
|
if (action.actionName === toggleTrayAction) {
|
||||||
|
targetWindow.focus();
|
||||||
|
} else {
|
||||||
showAndFocusWindow(targetWindow);
|
showAndFocusWindow(targetWindow);
|
||||||
|
}
|
||||||
|
|
||||||
targetWindow.webContents.send("globalShortcut", action.actionName);
|
targetWindow.webContents.send("globalShortcut", action.actionName);
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user