Skip to content

Instantly share code, notes, and snippets.

@listm
Last active September 30, 2020 08:18
Show Gist options
  • Save listm/ba4cac6c3af2ac258fa54897c7726e3a to your computer and use it in GitHub Desktop.
Save listm/ba4cac6c3af2ac258fa54897c7726e3a to your computer and use it in GitHub Desktop.
WSL2 GUI Startup Shortcut without Console Window

Start Phpstorm GUI inside WSL2 from Windows Shortcut (without console window)

I use a tool called Quiet.exe for this (found on Source [1]), have not managed to find a solution without it unfortunately

  • Install X410 or other Windows X servers, put startup code into /home/username/scripts/displayvar.sh (file content in my case for X410: export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0)
  • Install Phpstorm using Jetbrains toolbox, use option "Shell Scripts" -> "Generate shell scripts" ("Shell scripts location" in my case is /opt/shortcuts)
    • Starting phpstorm using /opt/shortcuts/phpstorm from inside WSL2 terminal will work now.. one could always start from here using the command /opt/shortcuts/phpstorm &
  • Allow starting from Windows shortcut:
    • Download Quiet.exe from here joeware.net (virustotal check), works also on Windows 10 Pro Build 19041 (20H1; May 2020 Update)
    • Create link on desktop (right click -> New -> Link) with following target:
      • `D:\Devtools\Quiet.exe C:\Users\username\AppData\Local\Microsoft\WindowsApps\ubuntu.exe run "source /home/username/scripts/displayvar.sh; /opt/shortcuts/phpstorm > /tmp/phpstorm-gui.log 2>&1"
      • Phpstorm log output will now go into /tmp/phpstorm-gui.log
      • Optional: set link icon to this one from iconarchive.com

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment