Like I said before in my Windows 10 review, I decided to try out Windows 10 as my work machine. If the global experience after two weeks is not that glorious, I still have some interesting little things for GNU/Linux enthusiasts stuck with Windows for whatever reason.

As I can’t decently work without a GNU environment, a decided to give Cygwin and VcXsrv a try.

Quick reminder, Cygwin is

  • a DLL for Windows emulating a POSIX environment
  • an installer for recompiled Linux/POSIX tools for Windows

VcXsrv is an X server for Windows, ported from X.org sources.

With the two combined, you have the equivalent of a GNU system working in Windows. But with the default configuration there’s still some little troubles you have to deal with (command prompt opening when launching some Cygwin programs, for example).

Installing Cygwin and VcXsrv

Nothing complicated here. Follow the references guide from each project and you’ll be good to go ! Just a little thing for Cygwin: don’t forget to check utilities you need will be installed (git, subversion, zsh or anything else). I manually selected zsh since I use it since a few years on all my Linux machines, and URxvt as terminal emulator.

After install, you’ll be able to launch the Cygwin shell from Windows with the shortcut on the Desktop or the start menu entry, like any other program.

Configuration

As I use URxvt with zsh on all my Linux boxes, I created a batch file to launch them. To do that, I needed to set the DISPLAY environment variable for Cygwin to be able to find VcXsrv X server, and launch an instance of the X server if none exists.

The look and feel of URxvt / zsh can be modified by VcXsrv’s Xdefault file (equivalent of Linux .Xdefault file for X server, found in install directory), and with your .zshrc file in your home directory, like if you were on Linux. Note that both file are in UNIX format and NOT Windows format. Don’t modify them with Windows notepad, use Cygwin’s nano or gedit for example.

But hey, why is there an ugly command prompt opening when launching URxvt ? Because Windows automatically allocates a new prompt when starting a program from a batch file. But there’s a way to change that. The trick is pretty simple : tell windows not to allocate new prompts when launching commands, start program in current prompt then exit it.

That’s done with the /B option of the start command in the batch file, combined with a VBS script (/B argument and NoShell.vbs script from Toby.J found here) telling Windows not to open new command prompts. Call the VBS script with the batch file as first argument and that’s it ! You’re good to go with a full GNU environment on Windows !

cygwin urxvt x forward

Tip

If you want to be able to directly use GNU tools in your standard Windows command prompt, just add Cygwin’s bin install directory to your PATH environment variable.

Sources

Cygwin homepage
VcXsrv homepage
superuser.com post for cmd prompt in batch files