mviereck / runx

Provide X server on MS Windows with cookie authentication.
MIT License
87 stars 14 forks source link
cookie cygwin gui linux-gui-applications ms-windows msys2 vcxsrv windows wsl wsl2 x x11docker xauthority xserver xwin

runx - Run Linux GUI applications on MS Windows

runx allows to easily run Linux GUI applications and desktops on MS Windows in Cygwin, MSYS2 or WSL.

Background:

For similar functionality on native Linux systems use x11docker with options --backend=host or --xonly.

Table of contents

Linux environments on MS Windows

runx can run in:

Installation

Installation in general:

Installation of X server

runx needs an X server. Install on MS Windows one or both of:

runx will automatically use XWin if available. You can specify the desired X server with options --xwin or --vcxsrv.

Installation in WSL

Installation in Cygwin

Installation in MSYS2

GPU hardware acceleration

runx supports GPU hardware accelerated graphics with option --gpu.

Usage examples

Providing X server in background

You can make an entry in the file ~/.bashrc to have an X server always available. Possible entry in ~/.bashrc:

source /usr/local/bin/runx

In future runs of the terminal you can directly run Linux GUI applications, e.g.:

pcmanfm

Use an already running X server

Output of runx --help

runx - Run Linux GUI applications on MS Windows.
Provides an X server on MS Windows in Cygwin, MSYS2 or WSL.

Syntax:
  runx [OPTIONS]  --  [COMMAND]

Options:
  -h, --help                   Show this help.
  -d, --desktop                Open a parent window for desktop environments.
  -g, --gpu                    Enable GPU hardware acceleration. Can fail 
                               with NVIDIA cards. Works best with XWin.
      --size WIDTHxHEIGHT      Window size for option --desktop, e.g. 800x600.
      --vcxsrv                 Use X server VcXsrv.
      --xwin                   Use X server XWin.
      --clipboard [=yes|no]    Enable clipboard sharing yes/no. Default: yes.
      --display N              Use display number N for new X server.
                               If the display number is already in use, runx will 
                               only provide the likely access credentials.
      --ip ADRESS              IP adress to use. Default: First found 192.168.*
      --no-auth                Disable X cookie authentication. Discouraged.
      --cleanup                Stop all X servers and delete cookies.
  -v, --verbose                Be verbose.

Installation of runx in WSL:
 - Copy runx into /usr/local/bin/
 - Make runx executeable:        sudo chmod +x /usr/local/bin/runx
 - Install xauth:                sudo apt update
                                 sudo apt install xauth

Install an X server on Windows:
  runx supports two X servers: VcXsrv and XWin. Install at least one of them.
   - VcXsrv: Download and install from: 
       https://sourceforge.net/projects/vcxsrv/
   - XWin: Download and install Cygwin64 with packages: xinit xauth
       https://www.cygwin.com
VcXsrv is easier to install. XWin provides a better GPU support.

WSL, Cygwin: runx starts XWin if available, otherwise it starts VcXsrv.
MSYS2:       runx supports VcXsrv only.

Usage:

Example to directly run an application with runx:
 - Install file manager pcmanfm: sudo apt update
                                 sudo apt install pcmanfm
 - Run pcmanfm with:             runx -- pcmanfm

Example to run Mate desktop:
 - Install Mate desktop with:    sudo apt install mate-desktop-environment
 - Run Mate desktop with:        runx --desktop -- mate-session

Example to get a Wayland environment:
 - Install Wayland compositor:   sudo apt install weston
 - Run Weston with:              XDG_RUNTIME_DIR=/tmp  runx -- weston

Providing an X server in background all the time:
 - Create an entry in ~/.bashrc: source /usr/local/bin/runx
 - In future terminal session you can directly run GUI commands.
   E.g. just type:  'pcmanfm'  instead of 'runx -- pcmanfm'.
 - If you specify a display number with --display, runx will re-use
   a possibly already running X server with same display number
   and only provide the access credentials DISPLAY and XAUTHORITY.
   This allows to use the same X server across several terminals.

runx stores the access credentials DISPLAY and XAUTHORITY in ~/.Xenv
This allows sourcing the file for custom access setups.

runx version 0.4.20
Please report issues and get help at:   https://github.com/mviereck/runx

Screenshot

runx running Mate desktop on MS Windows: Mate Desktop on MS Windows