mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
This commit is contained in:
parent
6b59e9d7f2
commit
72240c7f38
1 changed files with 16 additions and 2 deletions
|
|
@ -43,7 +43,7 @@ const windowStatePath = path.join(confDir, "windowState.json");
|
||||||
let bootWindow;
|
let bootWindow;
|
||||||
let latestActiveWindow;
|
let latestActiveWindow;
|
||||||
let firstOpen = false;
|
let firstOpen = false;
|
||||||
let workspaces = []; // workspaceDir, id, browserWindow, tray
|
let workspaces = []; // workspaceDir, id, browserWindow, tray, hideShortcut
|
||||||
let kernelPort = 6806;
|
let kernelPort = 6806;
|
||||||
let resetWindowStateOnRestart = false;
|
let resetWindowStateOnRestart = false;
|
||||||
|
|
||||||
|
|
@ -1098,6 +1098,12 @@ app.whenReady().then(() => {
|
||||||
if (!data.hotkeys || data.hotkeys.length === 0) {
|
if (!data.hotkeys || data.hotkeys.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
workspaces.find(workspaceItem => {
|
||||||
|
if (event.sender.id === workspaceItem.browserWindow.webContents.id) {
|
||||||
|
workspaceItem.hotkeys = data.hotkeys;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
data.hotkeys.forEach((item, index) => {
|
data.hotkeys.forEach((item, index) => {
|
||||||
const shortcut = hotKey2Electron(item);
|
const shortcut = hotKey2Electron(item);
|
||||||
if (!shortcut) {
|
if (!shortcut) {
|
||||||
|
|
@ -1111,11 +1117,19 @@ app.whenReady().then(() => {
|
||||||
let currentWorkspace;
|
let currentWorkspace;
|
||||||
const currentWebContentsId = (latestActiveWindow && !latestActiveWindow.isDestroyed()) ? latestActiveWindow.webContents.id : undefined;
|
const currentWebContentsId = (latestActiveWindow && !latestActiveWindow.isDestroyed()) ? latestActiveWindow.webContents.id : undefined;
|
||||||
workspaces.find(workspaceItem => {
|
workspaces.find(workspaceItem => {
|
||||||
if ((currentWebContentsId || event.sender.id) === workspaceItem.browserWindow.webContents.id) {
|
if (currentWebContentsId === workspaceItem.browserWindow.webContents.id && workspaceItem.hotkeys[0] === item) {
|
||||||
currentWorkspace = workspaceItem;
|
currentWorkspace = workspaceItem;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (!currentWorkspace) {
|
||||||
|
workspaces.find(workspaceItem => {
|
||||||
|
if (workspaceItem.hotkeys[0] === item && event.sender.id === workspaceItem.browserWindow.webContents.id) {
|
||||||
|
currentWorkspace = workspaceItem;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
if (!currentWorkspace) {
|
if (!currentWorkspace) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue