From bdec1215a0ad956f98f7cc47bfe99bea104cd861 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 6 Jan 2023 18:27:27 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF=E5=86=85?= =?UTF-8?q?=E6=A0=B8=E8=BF=9B=E7=A8=8B=E6=A0=B9=E6=8D=AE=20Electron=20?= =?UTF-8?q?=E4=B8=BB=E8=BF=9B=E7=A8=8B=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=80=80=E5=87=BA=20Fix=20https://github.com?= =?UTF-8?q?/siyuan-note/siyuan/issues/7002?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/process.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/kernel/model/process.go b/kernel/model/process.go index 1c3b4805d..0f73e8165 100644 --- a/kernel/model/process.go +++ b/kernel/model/process.go @@ -42,12 +42,7 @@ func HookDesktopUIProc() { return } - uiProcName := "siyuan" - if "dev" == util.Mode { - uiProcName = "electron" - } - - time.Sleep(30 * time.Second) + uiProcNames := []string{"siyuan", "electron"} existUIProc := false for range time.Tick(7 * time.Second) { util.UIProcessIDs.Range(func(uiProcIDArg, _ interface{}) bool { @@ -63,11 +58,13 @@ func HookDesktopUIProc() { return true } - if strings.Contains(strings.ToLower(proc.Executable()), uiProcName) { - existUIProc = true - return false + procName := strings.ToLower(proc.Executable()) + for _, name := range uiProcNames { + if strings.Contains(procName, name) { + existUIProc = true + return false + } } - return true })