Vanessa 2023-10-08 12:23:46 +08:00
parent c1e0b4ff60
commit 6b036fbe75
4 changed files with 15 additions and 10 deletions

View file

@ -1,8 +1,8 @@
import {exportLayout, JSONToLayout, resetLayout, resizeTopbar, resizeTabs} from "../layout/util";
import {setStorageVal} from "../protyle/util/compatibility";
/// #if !BROWSER
import {dialog, getCurrentWindow} from "@electron/remote";
import {ipcRenderer, OpenDialogReturnValue, webFrame} from "electron";
import {getCurrentWindow} from "@electron/remote";
import {ipcRenderer, webFrame} from "electron";
import * as fs from "fs";
import * as path from "path";
import {afterExport} from "../protyle/export/util";
@ -282,7 +282,7 @@ export const initWindow = (app: App) => {
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
zoomIn: focus,
});
ipcRenderer.send(Constants.SIYUAN_SHOW, getCurrentWindow().id);
ipcRenderer.send(Constants.SIYUAN_SHOW);
}
app.plugins.forEach(plugin => {
plugin.eventBus.emit("open-siyuan-url-block", {

View file

@ -25,6 +25,7 @@ export abstract class Constants {
// 渲染进程调主进程
public static readonly SIYUAN_SHOW: string = "siyuan-show";
public static readonly SIYUAN_HIDE: string = "siyuan-hide";
public static readonly SIYUAN_CONFIG_TRAY: string = "siyuan-config-tray";
public static readonly SIYUAN_QUIT: string = "siyuan-quit";
public static readonly SIYUAN_HOTKEY: string = "siyuan-hotkey";

View file

@ -5,7 +5,6 @@ import {exportLayout} from "../layout/util";
/// #endif
/// #if !BROWSER
import {ipcRenderer} from "electron";
import {getCurrentWindow} from "@electron/remote";
/// #endif
import {hideMessage, showMessage} from "./message";
import {Dialog} from "./index";
@ -200,7 +199,7 @@ export const exitSiYuan = () => {
// 桌面端退出拉起更新安装时有时需要重启两次 https://github.com/siyuan-note/siyuan/issues/6544
// 这里先将主界面隐藏
setTimeout(() => {
getCurrentWindow().hide();
ipcRenderer.send(Constants.SIYUAN_HIDE);
}, 2000);
// 然后等待一段时间后再退出,避免界面主进程退出以后内核子进程被杀死
setTimeout(() => {