wslg icon indicating copy to clipboard operation
wslg copied to clipboard

WSLg windows do not work with window-snapping (to sides or quarters)

Open trws opened this issue 3 years ago • 50 comments

Environment

Windows build number:  10.0.21364.0
Your Distribution version: Ubuntu 20.04 (seems to be distro agnostic however)
Your WSLg version: 10.0.17.1

Steps to reproduce

  1. Open any window under WSLg, I have tried xterm, thunar, gvim and firefox so far
  2. Attempt to snap the window with any of: dragging window to an edge of the display; hitting win-left or win-right; or snap some other window

Expected behavior

The window snaps to the side indicated, or in the case of snapping another window appears in the list of windows available to be snapped to the remaining space.

Actual behavior

The window stays where it is, or in the case of snapping another window the WSLg window does not appear in the list of windows available to use the remaining space.

trws avatar Apr 21 '21 21:04 trws

According to the blog post here : https://devblogs.microsoft.com/commandline/wslg-architecture/ this is not yet possible.

For example, the preview still uses server-side window movement and resizing, resulting in window 
move and resize operations which don’t feel as smooth as native, which also results in the inability 
to snap Linux windows on the edges of the monitors or to custom snap region.

simonernst avatar Apr 21 '21 21:04 simonernst

Yeah, unfortunately this is a known limitation at the moment. This is something we will enable in a future update.

spronovo avatar Apr 21 '21 22:04 spronovo

I wonder if there is some way of making new snapping feature on Windows 11 to work on WSLg windows. I haven't tested it yet and I don't think it will work.

just1a-person avatar Jun 25 '21 11:06 just1a-person

Can second this with alan, I really hope something like this could be achieved with Windows 11's reworkings.

CDAGaming avatar Jul 02 '21 23:07 CDAGaming

Could we just go the Linux route and get wslg to use a window manager like sway/mutter/kwin?

lirannl avatar Sep 21 '21 22:09 lirannl

I have a WSLg (X11) app that starts with the top of the frame off the top of my monitor. I can't find any way to move it down, since keyboard window moving doesn't work with WSLg!

garyo avatar Oct 19 '21 17:10 garyo

WSLg apps were working great for me for a while, however they now are being created off screen and I have no way to bring them into a visible area.

codycraven avatar Oct 28 '21 21:10 codycraven

A more severe issue is that when you maximize a window, there is no way back to unmaximize it or to resize it (tested with gnome application such as gedit or gnumeric). Or did I miss something?

parrenin avatar Jan 13 '22 17:01 parrenin

In WSL terminal try to add this:

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

and you should be able to see minimize/maximize buttons on your WSLg windows

iltoga avatar Jan 20 '22 02:01 iltoga

Well that worked, thanks, absolute lifesaver :)

streaky avatar Jan 20 '22 03:01 streaky

Is there any workaround like this for the offscreen-window problem?

garyo avatar Jan 20 '22 19:01 garyo

I forgot to comment, but for me adding the maximize/minimize buttons does not solve my problem: once a window is maximize, it is not possible to reduce or resize it anymore, the window is stuck in fullscreen.

parrenin avatar Jan 24 '22 13:01 parrenin

I agree with @parrenin, and also note that adding the buttons doesn't solve the core issue, which is that once a window comes up with its title bar off screen, there's nothing you can do at all.

garyo avatar Jan 24 '22 14:01 garyo

I'm stuck in full screen too, been using my Linux GUI apps for months fine but suddenly today it's stuck in full screen mode. Unsure if related but it's broken from dropdowns from within the application too (GitKraken).

How do you know if your WSL distro is using GNOME? I'm using Ubuntu currently. Is there a GNOME command to reset the state of an application? Or is this a WSLg bug?

Snaver avatar Feb 15 '22 16:02 Snaver

I figured out my stuck in maximized/full-screen issue!

In my specific scenario (GitKraken) you can toggle fullscreen with Ctrl+Shift+F, https://stackoverflow.com/questions/44543089/gitkraken-how-to-exit-fullscreen-mode.

Snaver avatar Mar 07 '22 11:03 Snaver

I understand this is potentially a hard one to solve, but I feel like I need to pile on. I just upgraded to Windows 11 with excitement about WSLg, to find that the experience is quite inferior to the way it was working for me in Windows 10 with VcXsrv.

(Edit: relatively quick window resizing, Windows-style titlebars, Windows cursors, and Window snapping (even with FancyZones) was working 100% in VcXsrv.)

Not being able to quickly snap my X11 windows (primarily Emacs) to half the screen like I do with everything else is pretty bad. Window resizing itself is a lot slower, and because we now see the X11 cursors, even the resize cursors are harder to see.

From a pure usability standpoint I fail to see how this is an improvement. I really hope we can figure out a middle ground on this. The snapping especially!

Edit 2: since posting this I have also found that resizing an X11 Emacs window frequently "crashes." It seems that the display is getting disconnected (when run from the terminal, there is no error output when this happens), but the process also ends. This is simply not usable for me... Attempting to grab the window to resize it often doesn't work at all, takes a couple tries, and then crashes. I will have to go back to running in the terminal until this is all resolved, which is really disappointing.

aaronbieber avatar Apr 14 '22 14:04 aaronbieber

Pure GTK (pgtk) got merged into emacs 29 thus you can compile emacs 29 with support GTK support which avoids many of the X11 emacs crashes you're experiencing. Here's a blog post by Emacs Redux showing how to get emacs working on WSL2 without the crashes you're experiencing: https://emacsredux.com/blog/2021/12/19/using-emacs-on-windows-11-with-wsl2/#fromHistory

morphykuffour avatar Jun 01 '22 16:06 morphykuffour

I think #727 is something very close to this issue, or even the same.

RiccardoManzan avatar Jun 09 '22 15:06 RiccardoManzan

I recently upgraded to WSL-0.61.8.0/WSLg-1.0.39 and I get a strange behavior.
When I launch Gnumeric for the first time after login, I get a different header bar than the usual gnome one, and I can maximize/un-maximize as expected. Also, the Gnumeric icon appears normally in the taskbar (#614). But the Gnumeric window does not scale correctly (it is blurry with a 200% scaling).
Then when I launch Gnumeric subsequently, the Gnumeric window scales properly, but I do not get the correct header bar and icon in the taskbar.

parrenin avatar Jul 13 '22 18:07 parrenin

Still the same issue.

AbstProcDo avatar Jul 14 '22 00:07 AbstProcDo

Hope this feature can be implemented soon. It has been more than one and a half year.

crotoc avatar Sep 08 '22 18:09 crotoc

would also like to see this issue fixed specifically for fancy zones support

xrishox avatar Sep 21 '22 18:09 xrishox

+1

solispauwels avatar Nov 18 '22 09:11 solispauwels

Any news on this issue? I know you're probably incredibly busy, but I would like to tell you that I would greatly appreciate this functionality. I've tried using both x410 and VcXsrv with some success but they both come with different pros and cons and I don't feel like investing the time necessary to make either of those perfect. WSLg works great for me except for this annoyance.

In my particular use case, I run my entire developer environment in WSL2 and open Jetbrains Rider with WSLg. It works but I would really like to have the same window management as the rest of my Windows applications. That being snapping to edges, being able to use Win + arrow keys, and Fancy zone support.

niklas-r avatar Dec 06 '22 12:12 niklas-r

Windows 11 22H2 has made further improvements on the "Snap layouts" feature - press "Windows key + Z" and windows can be moved around just with the keyboard (see https://pureinfotech.com/windows-11-22h2-new-features/ section "New Snap layouts drop menu" onwards)

Alas, none of the WSLg hosted windows participate in this feature.

Please, do enable WSLg hosted windows such that they can be "snapped" around.

shoffmeister avatar Mar 05 '23 14:03 shoffmeister

I saw there was a release of WSLg but nothing yet fixing this issue.

solispauwels avatar Mar 05 '23 22:03 solispauwels

+1

francescoboc avatar May 02 '23 14:05 francescoboc

Unfortunately WSLg doesn't seem to support this feature. Applications from WSL are not utilizing the native Windows UI so snapping doesn't work this way.

But I'm using an alternative XServer for about 1 1/2 years now which comes the intended behavior and even gives me the possibility to pin apps to the task bar and start them with a click onto the app icon.

I'm using MobaXterm with the following settings in my .zshrc:

# Display for XServer
# https://mip-cloud.gitlab.io/post/2020/10/idea-in-wsl2/
export LIBGL_ALWAYS_INDIRECT=1
export DISPLAY="`grep nameserver /etc/resolv.conf | sed 's/nameserver //'`:0"

Despite some minor issues this setup works great but I'd expect that the integrated XServer from MS works the same way so that you don't have to utilize 3rd party tools for this.

shillner avatar May 05 '23 14:05 shillner

Unfortunately WSLg doesn't seem to support this feature. Applications from WSL are not utilizing the native Windows UI so snapping doesn't work this way.

But I'm using an alternative XServer for about 1 1/2 years now which comes the intended behavior and even gives me the possibility to pin apps to the task bar and start them with a click onto the app icon.

I'm using MobaXterm with the following settings in my .zshrc:

# Display for XServer
# https://mip-cloud.gitlab.io/post/2020/10/idea-in-wsl2/
export LIBGL_ALWAYS_INDIRECT=1
export DISPLAY="`grep nameserver /etc/resolv.conf | sed 's/nameserver //'`:0"

Despite some minor issues this setup works great but I'd expect that the integrated XServer from MS works the same way so that you don't have to utilize 3rd party tools for this.

Do you mean we don't have to install an 3rth party XServer? Just put the two lines in the rc file and it will work? Thanks!

crotoc avatar May 05 '23 15:05 crotoc

Nope, mobaxterm has its own xserver. And MS have no xservers, it's Weston + rdp

eugenov avatar May 05 '23 15:05 eugenov