mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-06 09:51:14 +08:00
🎨 桌面端内核进程根据 Electron 主进程判断是否自动退出 Fix https://github.com/siyuan-note/siyuan/issues/7002
This commit is contained in:
parent
9854969cce
commit
d752f006ca
@ -53,9 +53,7 @@ try {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
require('electron').
|
require('electron').dialog.showErrorBox('创建配置目录失败 Failed to create config directory',
|
||||||
dialog.
|
|
||||||
showErrorBox('创建配置目录失败 Failed to create config directory',
|
|
||||||
'思源需要在用户家目录下创建配置文件夹(~/.config/siyuan),请确保该路径具有写入权限。\n\nSiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.')
|
'思源需要在用户家目录下创建配置文件夹(~/.config/siyuan),请确保该路径具有写入权限。\n\nSiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.')
|
||||||
app.exit()
|
app.exit()
|
||||||
}
|
}
|
||||||
@ -897,6 +895,7 @@ app.on('before-quit', (event) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const {powerMonitor} = require('electron')
|
const {powerMonitor} = require('electron')
|
||||||
|
const {write} = require("fs");
|
||||||
|
|
||||||
powerMonitor.on('suspend', () => {
|
powerMonitor.on('suspend', () => {
|
||||||
writeLog('system suspend')
|
writeLog('system suspend')
|
||||||
@ -934,11 +933,11 @@ powerMonitor.on('resume', async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
writeLog('sync after system resume')
|
|
||||||
workspaces.forEach(item => {
|
workspaces.forEach(item => {
|
||||||
const currentURL = new URL(item.browserWindow.getURL())
|
const currentURL = new URL(item.browserWindow.getURL())
|
||||||
fetch(getServer(currentURL.port) + '/api/sync/performSync',
|
const server = getServer(currentURL.port)
|
||||||
{method: 'POST'})
|
writeLog('sync after system resume [' + server + '/api/sync/performSync' + ']')
|
||||||
|
fetch(server + '/api/sync/performSync', {method: 'POST'})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ func HookDesktopUIProc() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
time.Sleep(30 * time.Second)
|
||||||
uiProcNames := []string{"siyuan", "electron"}
|
uiProcNames := []string{"siyuan", "electron"}
|
||||||
existUIProc := false
|
existUIProc := false
|
||||||
for range time.Tick(7 * time.Second) {
|
for range time.Tick(7 * time.Second) {
|
||||||
|
Loading…
Reference in New Issue
Block a user