Skip to content

Commit

Permalink
🎨 Open the last workspace by default #10570
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Mar 14, 2024
1 parent 271cf98 commit 6ff917f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 12 additions & 0 deletions kernel/model/conf.go
Expand Up @@ -587,6 +587,18 @@ func Close(force bool, execInstallPkg int) (exitCode int) {
clearWorkspaceTemp()
clearCorruptedNotebooks()
clearPortJSON()

// 将当前工作空间放到工作空间列表的最后一个
// Open the last workspace by default https://github.com/siyuan-note/siyuan/issues/10570
workspacePaths, err := util.ReadWorkspacePaths()
if nil != err {
logging.LogErrorf("read workspace paths failed: %s", err)
} else {
workspacePaths = gulu.Str.RemoveElem(workspacePaths, util.WorkspaceDir)
workspacePaths = append(workspacePaths, util.WorkspaceDir)
util.WriteWorkspacePaths(workspacePaths)
}

util.UnlockWorkspace()

time.Sleep(500 * time.Millisecond)
Expand Down
1 change: 0 additions & 1 deletion kernel/util/working.go
Expand Up @@ -243,7 +243,6 @@ func initWorkspaceDir(workspaceArg string) {
} else {
workspacePaths, _ = ReadWorkspacePaths()
if 0 < len(workspacePaths) {
// 取最后一个(也就是最近打开的)工作空间
WorkspaceDir = workspacePaths[len(workspacePaths)-1]
} else {
WorkspaceDir = defaultWorkspaceDir
Expand Down

0 comments on commit 6ff917f

Please sign in to comment.