Header bar for gtk3 application on Windows 10/11

I’ve followed the recommendation at The GTK Project - A free and open-source cross-platform widget toolkit for setting up the Windows build of my application (using gtk 3.24.43 plus the Windows 10 Transformation Pack). The Windows 10 theme works quite well, except that the app’s header bar doesn’t look like Windows.

To blend in, the header bar should have a small program icon, left-aligned, followed by the program title, also left-aligned, then window controls, right-aligned. I’ve been messing with gtk.css from the Windows 10 theme (gtk-3.20) version but I can’t figure out how to (a) insert an icon and (b) left-align the program title. Any help would be much appreciated.

Hi,

If you don’t use a custom GtkHeaderBar (or similar), then you can ask Windows to draw the tilebar, instead of using the Gtk falback one.

See this topic for details: Is there any way to render a native Windows window appearance?

Thank you! This suggestion works perfectly for the case where GTK3 is actually running on Windows 10 or 11.

1 Like

Just in case it’s of interest to anyone: my app offers a choice of the Adwaita, Windows-10 and Windows-10-Dark themes. After getting the user’s preference from the app’s config file I now use g_setenv() to set GTK_CSD: to 0 if a Windows theme is selected but to 1 if Adwaita is chosen, since the Adwaita-themed window looks better, IMO, with its CSD header bar.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.