When you just set DISPLAY environment variable and start Firefox, you'll get a window style similar to the screenshot shown below; it has a standard window title bar and a separate row for website tabs.

In order to remove the standard window title bar, you normally have a 'Title Bar' option in 'Customize Toolbar' settings. But unfortunately, you probably will not be able to find that 'Title Bar' option anywhere.

Do you still want to remove that window title bar? It's rather simple; just set MOZ_GTK_TITLEBAR_DECORATION environment variable to 'client' before launching Firefox. That missing 'Title Bar' option should now be shown in the 'Customize Firefox' page. Unchecking that newly found 'Title Bar' option should do the trick.

export MOZ_GTK_TITLEBAR_DECORATION=client









Firefox seems to have three title bar decoration modes: none, client, and system. One of those modes is selected according to your XDG_CURRENT_DESKTOP environment variable. Since you don't usually set this variable in WSL2, Firefox seems to select 'none' when it's launched from an Ubuntu/WSL2 console.

Please note that MOZ_GTK_TITLEBAR_DECORATION environment variable takes precedence over XDG_CURRENT_DESKTOP environment variable when Firefox selects its window decoration mode.

// Allow MOZ_GTK_TITLEBAR_DECORATION to override our heuristics
const char* decorationOverride = getenv("MOZ_GTK_TITLEBAR_DECORATION");
if (decorationOverride) {
  if (strcmp(decorationOverride, "none") == 0) {
    sGtkWindowDecoration = GTK_DECORATION_NONE;
  } else if (strcmp(decorationOverride, "client") == 0) {
    sGtkWindowDecoration = GTK_DECORATION_CLIENT;
  } else if (strcmp(decorationOverride, "system") == 0) {
    sGtkWindowDecoration = GTK_DECORATION_SYSTEM;
  }
  return sGtkWindowDecoration;
}

Share This Story, Choose Your Platform!