wslg icon indicating copy to clipboard operation
wslg copied to clipboard

Windows snapping layouts

Open RiccardoManzan opened this issue 3 years ago • 17 comments

Is your feature request related to a problem? Please describe. I have a WSL2 + WSLg on a windows 11 machine I would like to use window snapping layouts with WSL-installed applications

Describe the solution you'd like I would like to use windows snapping layouts when using WSL-installed applications

Describe alternatives you've considered none

Additional context none

RiccardoManzan avatar Apr 29 '22 09:04 RiccardoManzan

Do you mean like some other x11 servers do, x410 for example? изображение This is for firefox running from wsl2.

sergju avatar May 06 '22 07:05 sergju

Exactly! This is not available for me when using intellij.

RiccardoManzan avatar May 06 '22 08:05 RiccardoManzan

Yes, that is why I am using external x server x410 and waiting the same functional from WSLg.

sergju avatar May 06 '22 08:05 sergju

Basically, there is 2 snap UI. The first one is what above comments (https://github.com/microsoft/wslg/issues/727#issuecomment-1119330268), which is at applications title bar. This requires title bar to be rendered by Windows side, and some X server on Windows does support this, but for WSLg, our X11 window manager is in Linux side, thus this will require further changes to support this. Second one, is snap UI slide down from top of Windows's desktop (see below screen shot), this requires local move support in remote desktop protocol, and I'm working on this. However, given this also requires some changes in Window's side RDP client software, it requires some time to be completed, but below is showing the current progress, which xcalc (or any Linux app) can be snapped, thanks!

image

hideyukn88 avatar May 13 '22 01:05 hideyukn88

@hideyukn88 does powertoys fancyzones fall into the second category or would it require it's own separate support?

mrconnerton avatar Jun 03 '22 22:06 mrconnerton

Yes, that is why I am using external x server x410 and waiting the same functional from WSLg.

@sergju I have X410 but I don't have this feature. what settings do I have to change to get that same functionality?

morphykuffour avatar Jun 09 '22 16:06 morphykuffour

I have in my ~/bashrc

export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0.0
export LIBGL_ALWAYS_INDIRECT=1

mrconnerton avatar Jun 09 '22 16:06 mrconnerton

@mrconnerton could you explain what your code do?

mangkoran avatar Jun 18 '22 06:06 mangkoran

@mangkoran it grabs the ip from /etc/resolv.conf, which is the wsl ethernet adapter in windows, and uses it to set the X11 display env variable to ip_address:0.0. Honestly I can't remember why I have LIBGL_ALWAYS_INDIRECT set, but I remember having issues without it. So might be optional.

mrconnerton-encorehc avatar Jun 18 '22 22:06 mrconnerton-encorehc

Looking forward to this feature. Has waited for this feature for more than a year.

crotoc avatar Sep 08 '22 18:09 crotoc

Yes, that is why I am using external x server x410 and waiting thI e same functional from WSLg.

I can not do this using x410. Can I know what extra setting have you done? @sergju

crotoc avatar Sep 08 '22 19:09 crotoc

You just need to create %userprofile%\.wslconfig file with

[wsl2]
guiApplications=false

inside and restart wsl. This will turn off wslg. Thus you can use normal x11 server, such as x410 that support snapping.

eugenov avatar Sep 08 '22 20:09 eugenov

You just need to create %userprofile%\.wslconfig file with

[wsl2]
guiApplications=false

inside and restart wsl. This will turn off wslg. Thus you can use normal x11 server, such as x410 that support snapping.

Thanks very much! Suceed! : )

crotoc avatar Sep 08 '22 21:09 crotoc

I don't disable wslg to use x410. Just change display variable, but need to change gdk backend to x11. I think without changing backend wsl continues using wslg

export MY_EXT_IP=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}') export DISPLAY=$MY_EXT_IP:0.0 export GDK_BACKEND=x11

Sometimes comment this to check wslg behaviour

sergju avatar Sep 09 '22 15:09 sergju

I don't disable wslg to use x410. Just change display variable, but need to change gdk backend to x11. I think without changing backend wsl continues using wslg

export MY_EXT_IP=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}') export DISPLAY=$MY_EXT_IP:0.0 export GDK_BACKEND=x11

Sometimes comment this to check wslg behaviour

That's great to only revise files in wsl2. Thanks!

crotoc avatar Sep 10 '22 02:09 crotoc

I tried a VcxSrv and yeah, it's working but there are some other issues i'm not gonna deal with.

As already said, I think this is something very related to #22, and in that issue, much older than this one, there hasn't been any update lately. Is there any planning about this functionality?

RiccardoManzan avatar Dec 06 '22 16:12 RiccardoManzan

is anything updates?

erncabgppml057 avatar Apr 23 '25 12:04 erncabgppml057