Skip to content

Commit 9877bac

Browse files
committed
ux: display page name in front of workspace name in window title
Signed-off-by: leo <[email protected]>
1 parent 9f1d77d commit 9877bac

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/ViewModels/Launcher.cs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ public void SwitchWorkspace(Workspace to)
150150
OpenRepositoryInTab(node, null);
151151
}
152152

153-
_ignoreIndexChange = false;
154-
155153
var activeIdx = to.ActiveIdx;
156154
if (activeIdx >= 0 && activeIdx < Pages.Count)
157155
ActivePage = Pages[activeIdx];
158156
else
159157
ActivePage = Pages[0];
160158

159+
_ignoreIndexChange = false;
160+
PostActivePageChanged();
161161
Preferences.Instance.Save();
162162
GC.Collect();
163163
}
@@ -442,20 +442,15 @@ private void PostActivePageChanged()
442442
if (_ignoreIndexChange)
443443
return;
444444

445+
if (_activePage is { Data: Repository repo })
446+
_activeWorkspace.ActiveIdx = _activeWorkspace.Repositories.IndexOf(repo.FullPath);
447+
445448
var builder = new StringBuilder(512);
449+
builder.Append(string.IsNullOrEmpty(_activePage.Node.Name) ? "Repositories" : _activePage.Node.Name);
450+
446451
var workspaces = Preferences.Instance.Workspaces;
447452
if (workspaces.Count == 0 || workspaces.Count > 1 || workspaces[0] != _activeWorkspace)
448-
builder.Append('[').Append(_activeWorkspace.Name).Append("] ");
449-
450-
if (_activePage is { Data: Repository repo })
451-
{
452-
_activeWorkspace.ActiveIdx = _activeWorkspace.Repositories.IndexOf(repo.FullPath);
453-
builder.Append(_activePage.Node.Name);
454-
}
455-
else
456-
{
457-
builder.Append("Repositories");
458-
}
453+
builder.Append(" - ").Append(_activeWorkspace.Name);
459454

460455
Title = builder.ToString();
461456
CancelCommandPalette();

0 commit comments

Comments
 (0)