Score:1

Maximize and restore button not visible in WSL GUI window

cv flag

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 Ximg 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.

Score:3
vn flag

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 Ximg, that is an alternative way of running GUI applications in WSL. Under Windows 11, you don't typically need Ximg, since WSL2 includes the WSLg feature for running Ubuntu GUI applications.

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

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

    • Ximg: 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.

Gabriel Staples avatar
cn flag
`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 avatar
cn flag
Got it! From the link you had in your answer: `gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close"`
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.