Default OS window title bar looks completely different in Windows and Linux

What is up with the completely out of place look of gtk window title bar in Windows?
I remember I didnot set any custom decoration for the root window…but still…it shows as a big fat bar colored white. The window icon also disappeared and the call gtk.WindowSetDefaultIconName("app-logo") is absolutely useless…it can’t seem to find the icon? I set the icon location before with a call gtk.IconThemeGetForDisplay(gdk.DisplayGetDefault()).AddSearchPath("./res/images"). Under images directory you get the usual hicolor directory structure. But it seems all these calls don’t work for some reason…or am I missing something? It was working just fine in Linux with the window manager and such. Please help. Here is a screenshot of the bar:
fat_title_bar

Hi @darkc0der, to get native titlebars you can set the environment variable GTK_CSD=0

  • From the Command Prompt:
    set GTK_CSD=0
    path\to\myapp.exe
    
  • From PowerShell:
    $env:GTK_CSD="0"
    path\to\myapp.exe
    
  • From MSYS2 shell:
    GTK_CSD=0 path/to/myapp.exe
    
  • From code:
    int main() {
      g_setenv ("GTK_CSD", "0", TRUE);
    }
    
1 Like

Just a gentle reminder to please be nice. :smiley: People are going to feel happier about helping you if you’re not criticising their work.

1 Like

What does this variable mean and why do I need it? Where is the docs for this? Anyways thank you very much, I was so lost.

Sorry if i came of as rude, but I was actually very frustrated with this ‘minor’ issue.

UPDATE: After setting the env var this magically fixed the issue. The window is styled natively and the app icon loads properly. So the issues are fixed.

1 Like

Discourse allows you to mark lb90’s post as the solution to the question so it’s highlighted to others

Hi @darkc0der, most environment variables are documented at Gtk – 4.0: Running and debugging GTK Applications

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