diff --git a/windows/PopupWindow.xaml.cs b/windows/PopupWindow.xaml.cs index 57c9dda..7ed78d2 100644 --- a/windows/PopupWindow.xaml.cs +++ b/windows/PopupWindow.xaml.cs @@ -1,7 +1,9 @@ using ClaudeCheckerWindows.Controls; using System; +using System.Runtime.InteropServices; using System.Windows; using System.Windows.Controls; +using System.Windows.Interop; using System.Windows.Media; using System.Windows.Threading; @@ -14,6 +16,17 @@ public partial class PopupWindow : Window private readonly DispatcherTimer _clockTimer; private bool _dialogOpen; + [DllImport("dwmapi.dll")] + private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int value, int size); + + private void ApplyTitleBarTheme() + { + var hwnd = new WindowInteropHelper(this).Handle; + if (hwnd == IntPtr.Zero) return; + int dark = ThemeManager.IsDark ? 1 : 0; + DwmSetWindowAttribute(hwnd, 20, ref dark, sizeof(int)); + } + public PopupWindow() { InitializeComponent(); @@ -31,6 +44,8 @@ public partial class PopupWindow : Window UpdateFooter(); Closing += (_, e) => { e.Cancel = true; Hide(); }; + SourceInitialized += (_, _) => ApplyTitleBarTheme(); + ThemeManager.ThemeChanged += () => { ApplyTitleBarTheme(); RebuildCards(); }; } // ── Card rendering ───────────────────────────────────────────────