mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 使用第三方同步盘时弹出提示并退出内核 https://github.com/siyuan-note/siyuan/issues/7683
This commit is contained in:
parent
76da700991
commit
3aaae78cb7
1 changed files with 6 additions and 4 deletions
|
|
@ -61,23 +61,26 @@ try {
|
||||||
// type: port/id
|
// type: port/id
|
||||||
const exitApp = (type, id) => {
|
const exitApp = (type, id) => {
|
||||||
let tray;
|
let tray;
|
||||||
|
let mainWindow;
|
||||||
workspaces.find((item, index) => {
|
workspaces.find((item, index) => {
|
||||||
if (type === "id") {
|
if (type === "id") {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
|
mainWindow = item.browserWindow;
|
||||||
if (workspaces.length > 1) {
|
if (workspaces.length > 1) {
|
||||||
item.browserWindow.destroy();
|
item.browserWindow.destroy();
|
||||||
workspaces.splice(index, 1);
|
|
||||||
}
|
}
|
||||||
|
workspaces.splice(index, 1);
|
||||||
tray = item.tray;
|
tray = item.tray;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const currentURL = new URL(item.browserWindow.getURL());
|
const currentURL = new URL(item.browserWindow.getURL());
|
||||||
if (currentURL.port === id) {
|
if (currentURL.port === id) {
|
||||||
|
mainWindow = item.browserWindow;
|
||||||
if (workspaces.length > 1) {
|
if (workspaces.length > 1) {
|
||||||
item.browserWindow.destroy();
|
item.browserWindow.destroy();
|
||||||
workspaces.splice(index, 1);
|
|
||||||
}
|
}
|
||||||
|
workspaces.splice(index, 1);
|
||||||
tray = item.tray;
|
tray = item.tray;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -86,12 +89,11 @@ const exitApp = (type, id) => {
|
||||||
if (tray && ("win32" === process.platform || "linux" === process.platform)) {
|
if (tray && ("win32" === process.platform || "linux" === process.platform)) {
|
||||||
tray.destroy();
|
tray.destroy();
|
||||||
}
|
}
|
||||||
if (workspaces.length === 1) {
|
if (workspaces.length === 0 && mainWindow) {
|
||||||
try {
|
try {
|
||||||
if (resetWindowStateOnRestart) {
|
if (resetWindowStateOnRestart) {
|
||||||
fs.writeFileSync(windowStatePath, "{}");
|
fs.writeFileSync(windowStatePath, "{}");
|
||||||
} else {
|
} else {
|
||||||
const mainWindow = workspaces[0].browserWindow;
|
|
||||||
const bounds = mainWindow.getBounds();
|
const bounds = mainWindow.getBounds();
|
||||||
fs.writeFileSync(windowStatePath, JSON.stringify({
|
fs.writeFileSync(windowStatePath, JSON.stringify({
|
||||||
isMaximized: mainWindow.isMaximized(),
|
isMaximized: mainWindow.isMaximized(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue