├── .gitignore ├── README.md ├── i3win.png ├── invisible.vbs ├── launch_xsrv.bat ├── matewin.png ├── run_app.bat └── run_app_no_console.bat /.gitignore: -------------------------------------------------------------------------------- 1 | tmp.bat 2 | *.lnk 3 | *~ 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Launch Linux GUI applications / window managers on Windows 2 | 3 | Scripts to launch GUI applications / window managers installed on a Linux distribution from Windows Store. 4 | 5 | Requires VcXsrv installed in %programfiles% (e.g. C:\Program Files\VcXsrv). 6 | 7 | ## Features 8 | 9 | - checks if X server is running and automatically launches one 10 | - option to hide cmd window 11 | 12 | ## Syntax 13 | 14 | `run_app.bat/run_app_no_console.bat app_to_lauch window_mode screen_number bash_path pause_cmd_window_at_exit vcxsrv_executable` 15 | 16 | Defaults: 17 | - `app_to_launch: xterm` 18 | - `window_mode: multiwindow` 19 | - `screen_number: 0` 20 | - `bash_path: %systemroot%\system32\bash.exe` 21 | - `pause_cmd_window_at_exit: false` 22 | - `vcxsrv_executable: vcxsrv.exe` 23 | 24 | ## Tip 25 | 26 | For high-DPI displays tick "Override high DPI scaling behavior" and select "Application" in "Compatibility" tab of vcxsrv.exe properties. 27 | 28 | ## Examples 29 | 30 | It is convenient to create a shortcut to either `run_app.bat` or `run_app_no_console.bat`, with "Start in" parameter set to this repository directory and "Target" parameter specifying application to launch, e.g.: 31 | 32 | - urxvt terminal on Ubuntu: `cmd /C %userprofile%\projects\WSL-launch-GUI\run_app_no_console.bat urxvt multiwindow 0` 33 | - i3 on Ubuntu: `cmd /C %userprofile%\projects\WSL-launch-GUI\run_app_no_console.bat i3 nodecoration 1` 34 | - mate on openSUSE: `cmd /C %userprofile%\projects\WSL-launch-GUI\run_app_no_console.bat mate-session nodecoration 2 %userprofile%\AppData\Local\Microsoft\WindowsApps\openSUSE-42.exe` 35 | 36 | ![i3](i3win.png) 37 | 38 | ![mate](matewin.png) 39 | 40 | -------------------------------------------------------------------------------- /i3win.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbobrowski/WSL-launch-GUI/b2a01e35e29047361c29830b17cfdc1d172ca5c0/i3win.png -------------------------------------------------------------------------------- /invisible.vbs: -------------------------------------------------------------------------------- 1 | CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False -------------------------------------------------------------------------------- /launch_xsrv.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set xsrvexec=%1 4 | set dispnum=%2 5 | set windowmode=%3 6 | 7 | start "Xserver" /D "%programfiles%\VcXsrv" %xsrvexec% :%dispnum% -ac -terminate -lesspointer -%windowmode% -clipboard -wgl 8 | 9 | exit -------------------------------------------------------------------------------- /matewin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbobrowski/WSL-launch-GUI/b2a01e35e29047361c29830b17cfdc1d172ca5c0/matewin.png -------------------------------------------------------------------------------- /run_app.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set command=%1 4 | set windowmode=%2 5 | set dispnum=%3 6 | set bash=%4 7 | set pause=%5 8 | set vcxsrvexec=%6 9 | 10 | IF "%command%"=="" ( 11 | set command=xterm 12 | ) 13 | 14 | IF "%windowmode%"=="" ( 15 | set windowmode=multiwindow 16 | ) 17 | 18 | IF "%pause%"=="" ( 19 | set pause=false 20 | ) 21 | 22 | IF "%dispnum%"=="" ( 23 | set dispnum=0 24 | ) 25 | 26 | IF "%bash%"=="" ( 27 | set bash=%systemroot%\system32\bash.exe 28 | ) 29 | 30 | IF "%vcxsrvexec%"=="" ( 31 | set vcxsrvexec=vcxsrv.exe 32 | ) 33 | 34 | set disp=localhost:%dispnum%.0 35 | set pth=%cd%\launch_xsrv.bat %vcxsrvexec% %dispnum% %windowmode% 36 | set pth=%pth:\=\\\\% 37 | 38 | %bash% -c "export DISPLAY=%disp% && if ! xdpyinfo -display %disp% > /dev/null 2>&1; then /mnt/c/Windows/System32/cmd.exe /C %pth%; fi; %command%" 39 | 40 | IF %pause%==true ( 41 | pause 42 | ) 43 | 44 | exit -------------------------------------------------------------------------------- /run_app_no_console.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo @echo off > tmp.bat 4 | echo %cd%\run_app.bat %* >> tmp.bat 5 | echo exit >> tmp.bat 6 | 7 | wscript.exe "%cd%\invisible.vbs" "%cd%\tmp.bat" 8 | 9 | exit --------------------------------------------------------------------------------