From 962bca9ce4e0557525c6bb0204d1ef41905b5fe8 Mon Sep 17 00:00:00 2001 From: JC-Chung <52159296+JC-Chung@users.noreply.github.com> Date: Thu, 15 Oct 2026 11:33:08 +0800 Subject: [PATCH] fix: update window title when the active workspace is renamed --- src/ViewModels/Launcher.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs index 774fbe0e41..f75358b0cb 100644 --- a/src/ViewModels/Launcher.cs +++ b/src/ViewModels/Launcher.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.IO; using System.Text; @@ -26,7 +27,14 @@ public AvaloniaList Pages public Workspace ActiveWorkspace { get => _activeWorkspace; - private set => SetProperty(ref _activeWorkspace, value); + private set + { + if (_activeWorkspace != null) + _activeWorkspace.PropertyChanged -= OnActiveWorkspacePropertyChanged; + + if (SetProperty(ref _activeWorkspace, value) && _activeWorkspace != null) + _activeWorkspace.PropertyChanged += OnActiveWorkspacePropertyChanged; + } } public LauncherPage ActivePage @@ -520,6 +528,12 @@ private void CloseRepositoryInTab(LauncherPage page, bool removeFromWorkspace = page.Data = null; } + private void OnActiveWorkspacePropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == nameof(Workspace.Name)) + PostActivePageChanged(); + } + private void PostActivePageChanged() { if (_ignoreIndexChange)