Skip to content

feat: add Windows title bar theme synchronization#2005

Closed
ChouChiu wants to merge 1 commit into
Predidit:mainfrom
ChouChiu:1
Closed

feat: add Windows title bar theme synchronization#2005
ChouChiu wants to merge 1 commit into
Predidit:mainfrom
ChouChiu:1

Conversation

@ChouChiu
Copy link
Copy Markdown
Contributor

@ChouChiu ChouChiu commented Apr 24, 2026

由 Qwen 3.6 Plus 生成, fix #1757

image image image

Copilot's Summary:

This pull request introduces a new mechanism for synchronizing the Windows title bar theme with the app's theme, using a native Windows API via a custom Flutter MethodChannel. This replaces the previous approach that relied on the window_manager plugin, ensuring more reliable and immediate updates to the title bar appearance when the app theme changes or when the system brightness changes. The changes also clean up redundant or now-unnecessary code related to the old approach.

Windows Title Bar Theme Synchronization:

  • Added a native MethodChannel (com.predidit.kazumi/titlebar) to the Windows runner, using DwmSetWindowAttribute to set immersive dark mode for the title bar, bypassing registry checks and system-wide theme dependencies. (windows/runner/flutter_window.cpp, windows/runner/flutter_window.h) [1] [2] [3] [4]
  • Updated the Flutter app (lib/app_widget.dart) to use the new MethodChannel for syncing the Windows title bar theme on app startup, theme changes, and platform brightness changes. Falls back to the old plugin if the native call fails. [1] [2] [3] [4]

Code Cleanup and Refactoring:

  • Removed previous direct calls to window_manager.setBrightness from theme settings and theme change handlers, as these responsibilities are now handled by the new native channel. (lib/pages/settings/theme_settings_page.dart) [1] [2]

@ChouChiu ChouChiu marked this pull request as ready for review April 24, 2026 13:22
@Predidit
Copy link
Copy Markdown
Owner

为什么移除了 window_manager 的使用,改为了自定义实现, window_manager 有什么问题吗

@Predidit
Copy link
Copy Markdown
Owner

#1961 的早期实现中,window_manager 表现的很好

@ChouChiu
Copy link
Copy Markdown
Contributor Author

ChouChiu commented Apr 24, 2026

我尝试让 AI 回退到 window_manager 方案,但这又重新复现了 #1757 (comment)

@Predidit
Copy link
Copy Markdown
Owner

我在周末尝试一下

@ChouChiu
Copy link
Copy Markdown
Contributor Author

有进展吗

@Predidit
Copy link
Copy Markdown
Owner

我还没找到比较好的解决方案

@ChouChiu
Copy link
Copy Markdown
Contributor Author

这个 PR 是否是一个可用的 workaround

@Predidit
Copy link
Copy Markdown
Owner

此外我刚刚看了一下这个PR的实现,Qwen3.6 Plus 明显是个比 GLM5.1 更糟糕的模型,它假设 menthodChannel 会失败并在失败时回退到 windowManager 意义不明

如果最近 coding plan 涨价与断货没有太好的选择的话,可以试试 opencode go

@ChouChiu
Copy link
Copy Markdown
Contributor Author

此外我刚刚看了一下这个PR的实现,Qwen3.6 Plus 明显是个比 GLM5.1 更糟糕的模型,它假设 menthodChannel 会失败并在失败时回退到 windowManager 意义不明

如果最近 coding plan 涨价与断货没有太好的选择的话,可以试试 opencode go

emm,我有看过,等现在的到期了我试试。还有,我先前使用的是 GLM 5

@Predidit
Copy link
Copy Markdown
Owner

这个PR本身的实现思路我个人不是很认可,并且 Qwen 在具体的实施过程中代码也有问题

所以很抱歉我不能接受这个PR,如果没有你对这方面不是很熟悉,并且也没有比较厉害的模型帮助你的话,也许我们可以换个问题看看

这个问题留给我来解决

@Predidit Predidit closed this Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

开启系统标签栏,颜色和主题相差过大

2 participants