Skip to content
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

[WinUI] Use modern title bar #13712

Closed
3 tasks
niels9001 opened this issue Oct 9, 2021 · 20 comments
Closed
3 tasks

[WinUI] Use modern title bar #13712

niels9001 opened this issue Oct 9, 2021 · 20 comments
Assignees
Labels
Area-User Interface things that regard UX for PowerToys External Dependency-WinUI 3 Dependency on WinUI Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Tracker Issue that is used to collect multiple sub-issues about a feature UI refresh Tracker tag for module specific UI refresh

Comments

@niels9001
Copy link
Contributor

Multiple applications use XAML Islands that uses a win32 title bar by default. This doesn't provide a modern look and feel and is quite jarring in dark mode.

Once we can adopt WinUI 3, we can extend the content into the title bar and polish everything. As a tracker issue:

  • Settings
  • OOBE
  • PowerRename
@niels9001 niels9001 self-assigned this Oct 9, 2021
@niels9001 niels9001 added Area-User Interface things that regard UX for PowerToys Status-Blocked We can't make progress due to a dependency or issue External Dependency-WinUI 3 Dependency on WinUI UI refresh Tracker tag for module specific UI refresh Tracker Issue that is used to collect multiple sub-issues about a feature labels Oct 9, 2021
This was referenced Oct 9, 2021
@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented Oct 10, 2021

#732, #6715, #891, #2027

@JaiganeshKumaran
Copy link

Why not use a custom title bar with WPF itself?

@crutkas
Copy link
Member

crutkas commented Oct 28, 2021

@DHowett how do teams internally handle this with islands?

@crutkas
Copy link
Member

crutkas commented Oct 28, 2021

@JaiganeshKumaran becomes an accessibility nightmare. Rather create better guidance in docs / fix the issue(s) so everyone benefits.

@DHowett
Copy link
Member

DHowett commented Oct 29, 2021

Folks use DWMWA_USE_IMMERSIVE_DARK_MODE to switch their titlebars into dark mode on machines where dark theme is enabled.

Alternatively, people use custom title bars. It is an utter pain with System Islands and WinUI 2.x, so it is not worth doing.

@KingKoopaDE
Copy link

I hate that every title bar has a different design these days.
Why not just keep the Win32 title bar and create a uniform look?
And another thing that bothers me is that the new WinUi3 doesn't append msstyles colors and styles nor the HKCU\Control Panel\Corlors Colors.
That's one reason why even Win2k has a better dark mode than Win 10/11.

@JaiganeshKumaran
Copy link

I hate that every title bar has a different design these days. Why not just keep the Win32 title bar and create a uniform look? And another thing that bothers me is that the new WinUi3 doesn't append msstyles colors and styles nor the HKCU\Control Panel\Corlors Colors. That's one reason why even Win2k has a better dark mode than Win 10/11.

The default Win32 title bar isn't better either. It has many issues, some of which I have mentioned here: microsoft/microsoft-ui-xaml#5486. Custom title bars do cause inconsistency and many of them have broken accessibility, however, there's no solution for this currently. I have proposed a new modern default title bar for WinUI 3 which could solve the problem.

@crutkas
Copy link
Member

crutkas commented Jan 28, 2022

We're working on this little by little. We are actually blocked and waiting for WinUI 3.1 with elevation / multi-window support. Once those features are rolled in and is stable, we'll nab it in a heartbeat.

Settings / oobe needs multi-window.
PowerRename needs multi-win

@WilliamABradley
Copy link
Contributor

WilliamABradley commented Feb 22, 2022

@DHowett @crutkas

DWMWA_USE_IMMERSIVE_DARK_MODE could be a good stopgap until WinUI support improves.

In the latest insider preview, Mica was added to most titlebars (Although light Mica), but if you used DWMWA_USE_IMMERSIVE_DARK_MODE (Like DBeaver just added, see below), you get dark Mica.

https://stackoverflow.com/a/62811758/5001796
It is applied directly to the HWND, so it has no framework dependencies.

Screenshot (13)

@WilliamABradley
Copy link
Contributor

WilliamABradley commented May 16, 2022

Is this easier now that PowerToys is on WinUI3/WinAppSDK?
DWMWA_USE_IMMERSIVE_DARK_MODE would work either way, you just need a PR?

@crutkas
Copy link
Member

crutkas commented May 16, 2022

Only settings is on WinUI 3 currently.

@WilliamABradley
Copy link
Contributor

WilliamABradley commented May 16, 2022

Screenshot (23)

Using the DWM Attribute doesn't require WinUI 3, I have ported the code to C++ and have it running for PowerRename as you can see in my screenshot.

I could go and do the others and make a PR?

@jaimecbernardo
Copy link
Collaborator

Current code base also moved PowerRename to WinUI3. Wonder if that would conflict with your changes. @stefansjfw , did WinUI3 port fix this issue?

@WilliamABradley
Copy link
Contributor

It shouldn't do.

WinUI 3 still doesn't ship with a Theme Aware Titlebar, the discussion in WinAppSDK can be found here: microsoft/WindowsAppSDK#41

A lot of the discussion mentions the use of DWMWA_USE_IMMERSIVE_DARK_MODE which is what I implemented here.

This is the workaround until a cleaner solution is implemented.

@stefansjfw
Copy link
Collaborator

No. I didn't touch title bar. @niels9001 Gave it a try but there were some issues with Win11 vs Win10 API support

@stefansjfw
Copy link
Collaborator

Screenshot (23)

Using the DWM Attribute doesn't require WinUI 3, I have ported the code to C++ and have it running for PowerRename as you can see in my screenshot.

I could go and do the others and make a PR?

Nice! I like how this looks like

@WilliamABradley
Copy link
Contributor

WilliamABradley commented May 16, 2022

Here is my draft branch I made today, I can also write the support to handle in all the other apps: #18315

I noticed however, I will need to detect and toggle it on and off when the user switches theme, so that is something that needs to be implemented in this approach.

I know I worked with @michael-hawker on Windows Community Toolkit to make a theme detector, so something like that could work.

@michael-hawker
Copy link
Contributor

@WilliamABradley good to see you again! The theme APIs don't work on WinUI 3 the same way, so the nice helpers in the Toolkit for WinUI 3 don't work either.

I don't know if there's a plan for polyfills to be created for WinUI 3 in an upcoming version, or if we'd have to re-write the WinUI 3 version of our helper to listen to the raw windows messages. We wouldn't want to do anything like that until we consolidate our codebase for our 8.0 release as we're trying to merge our forks together.

@WilliamABradley
Copy link
Contributor

Hmm, I might have to play around, also the code is C++, so I would have to re-write the extension anyway.
I'll see if I can come up with something without having to intercept Raw Windows Messages tonight.

@jaimecbernardo jaimecbernardo added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-Blocked We can't make progress due to a dependency or issue labels Jul 1, 2022
@crutkas
Copy link
Member

crutkas commented Jul 22, 2022

We released 0.60.1 and this is included in it! https://aka.ms/installpowertoys

@crutkas crutkas closed this as completed Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface things that regard UX for PowerToys External Dependency-WinUI 3 Dependency on WinUI Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Tracker Issue that is used to collect multiple sub-issues about a feature UI refresh Tracker tag for module specific UI refresh
Projects
None yet
Development

No branches or pull requests

10 participants