WSL configuration

  1. Install i3

     sudo apt install i3 -y
  2. Create an init script

     vim ~/src/scripts/
source ~/.zshrc
# If not running interactively, don't do anything
[ -z "$PS1" ] && return

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

dbus_status=$(service dbus status)
if [[ $dbus_status = *"is not running"* ]]; then
  sudo service dbus --full-restart

To run WSL2 as root

wsl.exe -d Ubuntu-20.04 -u root -- /bin/bash

Windows configuration

  1. Install vcxsrv from powershell

     winget install vcxsrv

With WSL2 you need to configure your firewall to allow WSL and vcxsrv to communicate.

Search for Windows Defender Firewall with Advanced Security and do the following:

  1. Create an inbound rule:

     name: wsl2
     rule type: port
     port type: tcp
     port number: 6000
  2. Narrow the scope of your inbound rule:

     Right click -> Properties -> scope -> Remote IP addresses -> Add

  3. Search for VcXsrv windows xserver inbound rules and make sure the 4 rules are enabled and in allow mode


  1. Startup i3 script from Windows vcxsrv.vbs

     code vcxsrv.vbs
Set shell = CreateObject("WScript.Shell" ) 

shell.Run """C:\Program Files\VcXsrv\vcxsrv.exe"" :0 -screen 0 @1 -ac -engine 1 -nodecoration -wgl"

WScript.Sleep 200

shell.Run "wsl.exe -d YOUR_DISTRO -u YOUR_USER -- /bin/zsh ~/src/scripts/", 0
  1. And just run your script from powershell


You should see this screen.


i3 configuration

Up to you.