From 98bd736a668bdf122d2963025bc91821b2e479b8 Mon Sep 17 00:00:00 2001 From: SuperDooper <37051355+superdooper86@users.noreply.github.com> Date: Fri, 8 May 2026 13:47:49 +0200 Subject: [PATCH] feat: system light/dark theme support with live switching and dark title bar --- windows/PopupWindow.xaml.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 ───────────────────────────────────────────────