mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Support minimize the main window after auto launch on Windows/macOS https://github.com/siyuan-note/siyuan/issues/11145
This commit is contained in:
parent
03a6c15d70
commit
b64a9a3ad2
10 changed files with 75 additions and 17 deletions
|
|
@ -421,9 +421,44 @@ func setAutoLaunch(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
autoLaunch := arg["autoLaunch"].(bool)
|
||||
model.Conf.System.AutoLaunch = autoLaunch
|
||||
autoLaunch := int(arg["autoLaunch"].(float64))
|
||||
model.Conf.System.AutoLaunch2 = autoLaunch
|
||||
model.Conf.Save()
|
||||
|
||||
windowStateConf := filepath.Join(util.ConfDir, "windowState.json")
|
||||
windowState := map[string]interface{}{}
|
||||
if gulu.File.IsExist(windowStateConf) {
|
||||
succ := false
|
||||
const maxRetry = 7
|
||||
for i := 0; i < maxRetry; i++ {
|
||||
data, err := os.ReadFile(windowStateConf)
|
||||
if nil != err {
|
||||
logging.LogErrorf("read [windowState.json] failed [%d/%d]: %s", i, maxRetry, err)
|
||||
time.Sleep(time.Second)
|
||||
} else {
|
||||
if err = gulu.JSON.UnmarshalJSON(data, &windowState); nil != err {
|
||||
logging.LogErrorf("unmarshal [windowState.json] failed: %s", err)
|
||||
} else {
|
||||
succ = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if !succ {
|
||||
logging.LogErrorf("read [windowState.json] failed")
|
||||
}
|
||||
}
|
||||
windowState["autoLaunch"] = autoLaunch
|
||||
|
||||
data, err := gulu.JSON.MarshalJSON(windowState)
|
||||
if nil != err {
|
||||
logging.LogErrorf("marshal [windowState.json] failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = gulu.File.WriteFileSafer(windowStateConf, data, 0644); nil != err {
|
||||
logging.LogErrorf("create [windowState.json] failed: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func setDownloadInstallPkg(c *gin.Context) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue