Sublime Forum

Any tips for working on Windows with WSL 2?

#1

I have a project that needs to run under the WSL 2 Linux file system on Windows (can’t store in Windows file system, because it runs in Docker and I’m on Windows 10 Home, which means I need WSL 2 for Docker Desktop support), and I’m having a bit of trouble figuring out how to fit Sublime Merge into my workflow since file access across system boundaries is not good under WSL 2. Has anyone tried running Sublime Merge under WSL 2 on the Linux side of things? Or are there better alternatives?

In particular, I’m wondering if just running through the Linux installation steps will do the trick, or if there are any gotchas to look out for; and whether I can still access it through the Start menu, or how else to launch the app.

0 Likes

#2

Just try to install it, should be no problem. I haven’t switched to WSL2 yet but am running ST and SM on WSL without problems, actually more convenient than going across system boundaries, for what I use it for at least. They won’t be in the start menu, you launch them like on any other linux installation i.e. smerge& on a commandline. And you need an X server running on Windows, XLaunch is painless to use, and it’ll be just as if you’re running SM on Windows directly.

0 Likes

#3

@stijn Unfortunately, this is not working for me. I installed the latest Xming to get Xlaunch, then configured it according to this article (setting the display number to 0 and ensuring the DISPLAY variable is set in my session, mainly):

https://www.artemix.org/blog/linux-softwares-on-windows.html

I then installed Sublime Merge in WSL2, and was able to verify it installed successfully with smerge --help. However, whenever I run any smerge command that should open a GUI, nothing happens. No errors in the console, no errors in the Xming logs, nothing I can find.

If anyone has any idea what might be going wrong here, I would love to hear. Unfortunately, my expectations of this not working very well seem to be bearing out, and I’m currently stuck without any access to anything beyond the git command line. :disappointed:

0 Likes

#4

Nevermind, I got it! Key pieces:

  1. Export the local IP in WSL2 CLI:
    export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0
    
  2. Ensure Xming server is allowed through both public and private networks in the Windows Defender firewall
  3. Check the ‘No Access Control’ checkbox when configuring with XLaunch.

The fonts are all blurry and nasty looking, but I’ve got Sublime Merge working using the above steps (wish there were a way to do this without opening it up to all networks, but I really don’t know enough about what I’m doing to get that configured).

0 Likes

#5

Sorry I didn’t know how much you know your way around with linux and windows so did’t add actual instructions. For me DISPLAY=:0.0 works (not sure why you’d need an IP adress in there), and I only allow vcxsrv.exe for the private network (which Windows asks for the first time you run it normally, and which is all which should be needed), and fonts look similar to what I have in other linux environments though yes if I compare it side by side with native windows SM it’s a bit blurry, but still totally usable.

0 Likes