From 38c936b277dbfd7752a5a93615b7df4054b00570 Mon Sep 17 00:00:00 2001 From: GabrielDuf Date: Mon, 8 Jun 2026 15:57:47 -0400 Subject: [PATCH] Fix UI not fully updating on runtime system theme change --- src/UniGetUI/MainWindow.xaml.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/UniGetUI/MainWindow.xaml.cs b/src/UniGetUI/MainWindow.xaml.cs index eb73f143d..becbc1855 100644 --- a/src/UniGetUI/MainWindow.xaml.cs +++ b/src/UniGetUI/MainWindow.xaml.cs @@ -61,7 +61,10 @@ public MainWindow() ExtendsContentIntoTitleBar = true; AppWindow.TitleBar.PreferredHeightOption = TitleBarHeightOption.Tall; SetTitleBar(MainContentGrid); - MainContentGrid.ActualThemeChanged += (_, _) => ApplyTitleBarButtonColors(); + // System theme changed at runtime: re-sync the cached theme, title bar and tray icon + MainContentGrid.ActualThemeChanged += (_, _) => { ApplyTheme(); UpdateSystemTrayStatus(); }; + // Tray icon follows the system theme even when the app theme is fixed + MainApp.Instance.ThemeListener.ThemeChanged += (_) => DispatcherQueue.TryEnqueue(UpdateSystemTrayStatus); AppWindow.SetIcon( Path.Join(CoreData.UniGetUIExecutableDirectory, "Assets", "Images", "icon.ico") );