0

I have WSL 2 installed with Ubuntu and the i3 window manager. I want to run VSCode in the i3 x server environment, but whenever I run VSCode it's opened as a Microsoft Windows window. How do I force VSCode to be executed in the i3 x environment?

The main reason I use i3 is for tiling and lovely shortcuts, and the fact that VSCode is executed outside of this tiling environment makes it absolutely useless.


System information

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.5 LTS
Release:    20.04
Codename:   focal

I3 wm version

i3 version 4.17.1 (2019-08-30) © 2009 Michael Stapelberg and contributors

vscode version

1.71.2
74b1f979648cc44d385a2286793c226e611f59e7
x64

1 Answer 1

1

Short answer: Install and use the Linux version of VSCode under WSL to have it be managed by i3.


Explanation:

i3 does not have the ability to understand or manage Windows applications running under the Windows Desktop Window Manager (DWM), as i3 is actually running inside a Windows application itself -- Your X display/server, whether that's WSLg, VcXsrv, etc.

There's probably no technical reason that I can think of that i3 (or another WM) couldn't be coded to manage both X applications and Windows applications under WSL. But as a Linux application, it shouldn't be surprising that i3 is only coded to manage X/Linux applications.

The main reason I use i3 is for tiling and lovely shortcuts, and the fact that VSCode is executed outside of this tiling environment makes it absolutely useless.

Are you just making that assertion about VSCode? Or is any Windows application that can't be managed by i3 "absolutely useless"? I ask because it seems you may be happier running either a pure-Linux environment or, if you are stuck on Windows for some reason, perhaps a full Linux virtual machine under Windows.

Either way--under WSL2, a VM, or pure Linux--you do have the option of installing and running the Linux version of VSCode, which should be manageable by i3.


I'm partial to the keyboard myself, so it's probably a good thing I never became hooked on i3, or I'd likely have a tough time making the transition to Windows.

While it's not in the same league as i3, if you do need to continue on Windows, you may want to install Microsoft's PowerToys, available in the Store. It includes:

  • PowerToys Run: A search/launcher in the spirit of Spotlight (and others). It could serve to replace (and probably exceed the functionality of) i3's dmenu.

  • FancyZones: For snapping window management. Includes some keyboard control, but definitely doesn't have the auto-tiling that I'm sure you love from i3.

2
  • The issue was that I've already installed linux version using .deb file and removed Window's version, but it still was opening it in the DWM. Due to not related reasons, I had to re-install i3 and re-run WSL (using wsl --shutdown), xserver and windows itself several times, and it was fixed probably by some of these. Thanks anyways.
    – validname
    Sep 16, 2022 at 22:13
  • 1
    @validname Ah, that may have been due to the VSCode native "server" being installed in WSL. That's what connects VSCode and WSL normally, but it may have been confused by the Linux version (after uninstalling the Windows version). Make sure to delete the ~/.vscode-server directory if it exists to keep that from happening again. Sep 16, 2022 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.