Skip to content

Commit 962bca9

Browse files
committed
fix: update window title when the active workspace is renamed
1 parent d8a71a3 commit 962bca9

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎src/ViewModels/Launcher.cs‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using System.IO;
34
using System.Text;
45

@@ -26,7 +27,14 @@ public AvaloniaList<LauncherPage> Pages
2627
public Workspace ActiveWorkspace
2728
{
2829
get => _activeWorkspace;
29-
private set => SetProperty(ref _activeWorkspace, value);
30+
private set
31+
{
32+
if (_activeWorkspace != null)
33+
_activeWorkspace.PropertyChanged -= OnActiveWorkspacePropertyChanged;
34+
35+
if (SetProperty(ref _activeWorkspace, value) && _activeWorkspace != null)
36+
_activeWorkspace.PropertyChanged += OnActiveWorkspacePropertyChanged;
37+
}
3038
}
3139

3240
public LauncherPage ActivePage
@@ -520,6 +528,12 @@ private void CloseRepositoryInTab(LauncherPage page, bool removeFromWorkspace =
520528
page.Data = null;
521529
}
522530

531+
private void OnActiveWorkspacePropertyChanged(object sender, PropertyChangedEventArgs e)
532+
{
533+
if (e.PropertyName == nameof(Workspace.Name))
534+
PostActivePageChanged();
535+
}
536+
523537
private void PostActivePageChanged()
524538
{
525539
if (_ignoreIndexChange)

0 commit comments

Comments
 (0)