mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
This commit is contained in:
parent
c1e0b4ff60
commit
6b036fbe75
4 changed files with 15 additions and 10 deletions
|
|
@ -655,15 +655,20 @@ app.whenReady().then(() => {
|
|||
|
||||
resetTrayMenu(tray, lang, mainWindow);
|
||||
};
|
||||
|
||||
const getWindowByContentId = (id) => {
|
||||
return BrowserWindow.fromId(BrowserWindow.getAllWindows().find((win) => win.webContents.id === id).id)
|
||||
};
|
||||
ipcMain.on("siyuan-open-folder", (event, filePath) => {
|
||||
shell.showItemInFolder(filePath);
|
||||
});
|
||||
ipcMain.on("siyuan-first-quit", () => {
|
||||
app.exit();
|
||||
});
|
||||
ipcMain.on("siyuan-show", (event, id) => {
|
||||
showWindow(BrowserWindow.fromId(id));
|
||||
ipcMain.on("siyuan-show", (event) => {
|
||||
showWindow(getWindowByContentId(event.sender.id));
|
||||
});
|
||||
ipcMain.on("siyuan-hide", (event) => {
|
||||
getWindowByContentId(event.sender.id).hide();
|
||||
});
|
||||
ipcMain.on("siyuan-config-tray", (event, data) => {
|
||||
workspaces.find(item => {
|
||||
|
|
@ -686,7 +691,7 @@ app.whenReady().then(() => {
|
|||
return;
|
||||
}
|
||||
data.filePaths = result.filePaths;
|
||||
BrowserWindow.fromId(BrowserWindow.getAllWindows().find((win) => win.webContents.id === event.sender.id).id).getParentWindow().send("siyuan-export-pdf", data);
|
||||
getWindowByContentId(event.sender.id).getParentWindow().send("siyuan-export-pdf", data);
|
||||
});
|
||||
});
|
||||
ipcMain.on("siyuan-export-close", (event) => {
|
||||
|
|
@ -781,7 +786,7 @@ app.whenReady().then(() => {
|
|||
// 系统托盘
|
||||
tray = new Tray(path.join(appDir, "stage", "icon-large.png"));
|
||||
tray.setToolTip(`${path.basename(data.workspaceDir)} - SiYuan v${appVer}`);
|
||||
const mainWindow = BrowserWindow.fromId(BrowserWindow.getAllWindows().find((win) => win.webContents.id === event.sender.id).id);
|
||||
const mainWindow = getWindowByContentId(event.sender.id)
|
||||
resetTrayMenu(tray, data.languages, mainWindow);
|
||||
tray.on("click", () => {
|
||||
showHideWindow(tray, data.languages, mainWindow);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue