New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to theme window title bar? #2184
Comments
Could you please fill out all of the issue template? Using the issue template makes it much easier for us to understand, diagnose, and try to resolve the issues. |
OS: Win 10 Open fyne_demo.exe, and select Dark theme, but window's title bar is not themed. |
This should happen automatically, I wonder if it is something to do with how we are setting up the Window. |
Here is a small app that can be an investigation starting point: https://github.com/ysc3839/win32-darkmode |
A permalink to that for ease of discovery: https://github.com/ysc3839/win32-darkmode/blob/cc26549b65b25d6f3168a80238792545bd401271/win32-darkmode/DarkMode.h#L107-L123 |
I know win32-darkmode, but I don't have good idea to integrate with fyne and ensure don't break fyne design principle. |
Thanks for all of these hints, it is such a shame this doesn't just work. |
Looks like there's no pure c++ API to handle this and win32-darkmode is not able to do what it states at least on my PC (win10 20H2 build 19042.928) and i see other oldschool apps like notepad++ q-dir, conemu are using white titlebar. There's quite common workaround though. It's possible to create headless windows and draw titlebar at the toolkit level, basically a toolbar. This way is safer than the https://docs.microsoft.com/en-us/windows/win32/gdi/wm-ncpaint handling. upd: https://stackoverflow.com/questions/33052651/glfw-how-to-drag-undecorated-window |
Maybe DWM api is best. This sample use dwm api to draw title bar. |
Yes, DWM is pretty similar to the NCPaint approach and it allows to extend the titlebar but the main problem is the consistency. I can draw custom colors for the title but there are window buttons and they are not redrawn. They can look differently basing on Windows OS setup and version. Maybe i'm wrong but i believe to achieve the goal the whole window controls set should be recreated. The question is where:
The third one looks like easier to implement and more flexible |
Our solution needs to look and behave identically to the system title bars. |
It's always possible that something is missing and i'm not an expert there so could be wrong so i would treat that as my vision. I'm basing on the several items:
|
I have tested some win32 sdk approach. In my win32 c++ app my choice is : Create main window without caption, and create theme-able title bar control to replace system title bar even I need to implement mouse drag, window resize and system menu. |
That's what i mean. And in my version of reality it's much easier and flexible to do this using fyne controls and this trick: |
That PR should fix the problem for WIndows 10 users, please let me know if it works for you :) |
I tested it. It's work, but can not switch back to light in time, I have to restart it after I changed demo settings. |
Unfortunately we do not yet have a way to be told when the operating system theme changes. |
Marking as closed as the dark mode fix is in |
Select dark theme, but window title bar is not themed. My OS (win 10) system theme is dark mode.
To Reproduce:
Steps to reproduce the behaviour:
Screenshots:
Example code:
Device (please complete the following information):
The text was updated successfully, but these errors were encountered: