2

I've recently started using WSL2 with GUI. I started by reading this. I am able to use the apps easily, however the window does not have maximize and restore button, but only close:

image

I also saw a YouTube video where the guy said Xming needs to be installed to run WSL GUIs, but for me it ran without that, and installing Xming didn't have any effect.

Is it because I missed a step or is it a limitation of my PC?

I am using Windows 11.

jlliagre
  • 5,833
USER2
  • 31

1 Answers1

5

This is expected and is how many GUI applications work in Ubuntu. You don't mention exactly which applications you are using, but from the screenshot, that one appears to be written using the GTK toolkit. GTK (a.k.a. Gnome) apps do not, by default, including a minimize or maximize icon in the window title area.

Other applications may use other toolkits. For instance, if you install xterm, you will see a minimize and maximize icon.

You can, however, add minimize and maximize controls to GTK apps by running:

gsettings set org.gnome.desktop.wm.preferences button-layout "close,minimize,maximize:"

See this answer for more details and options.

As for Xming, that is an alternative way of running GUI applications in WSL. Under Windows 11, you don't typically need Xming, since WSL2 includes the WSLg feature for running Ubuntu GUI applications.

However, if you do want to use Xming, yes, you likely did miss a step. You would need to:

  • Correctly set your DISPLAY environment variable to point to Xming instead of WSLg:

    • Xming: export DISPLAY=$(hostname).local:0
    • WSLg (the default): export DISPLAY=:0 (automatically configured)
  • You'll also need to make sure your Windows firewall allows the connection from WSL2 to Windows (since WSL2 is actually on a separate virtual network). Using Windows Defender, you should normally see the "Allow" popup box the first time you use it, but if you miss it, you'll need to set it manually.

jlliagre
  • 5,833
NotTheDr01ds
  • 17,888
  • gsettings set org.gnome.desktop.wm.preferences button-layout "close,minimize,maximize:" did work to get the minimize and maximize buttons, but they are on the left. How do I get them on the right? – Gabriel Staples Aug 09 '23 at 03:55
  • Got it! From the link you had in your answer: gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close" – Gabriel Staples Aug 09 '23 at 03:56